aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Enmarcha.Backend/Services/ShapeTraversalService.cs17
-rw-r--r--src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs2
2 files changed, 17 insertions, 2 deletions
diff --git a/src/Enmarcha.Backend/Services/ShapeTraversalService.cs b/src/Enmarcha.Backend/Services/ShapeTraversalService.cs
index 1f77929..10de3e0 100644
--- a/src/Enmarcha.Backend/Services/ShapeTraversalService.cs
+++ b/src/Enmarcha.Backend/Services/ShapeTraversalService.cs
@@ -41,7 +41,22 @@ public class ShapeTraversalService
foreach (var point in points)
{
- var transformed = inverseTransform.Transform(new[] { point.Longitude, point.Latitude });
+ double[]? transformed = null;
+ try
+ {
+ transformed = inverseTransform.Transform(new[] { point.Longitude, point.Latitude });
+ }
+ catch (Exception)
+ {
+ _logger.LogError("Exception while transforming point from {Lat},{Lon}", point.Latitude, point.Longitude);
+ continue;
+ }
+
+ if (transformed is null)
+ {
+ _logger.LogError("Transformed point from {Lat},{Lon} is null", point.Latitude, point.Longitude);
+ continue;
+ }
shape.Points.Add(new Epsg25829 { X = transformed[0], Y = transformed[1] });
}
return shape;
diff --git a/src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs b/src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs
index bb6a251..298e2f4 100644
--- a/src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs
+++ b/src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs
@@ -46,5 +46,5 @@ public class Epsg25829
public class Shape
{
public string ShapeId { get; set; }
- public List<Epsg25829> Points { get; set; }
+ public List<Epsg25829> Points { get; set; } = [];
}