From e4867f93c626a3d8ed84d7c07d4a597e1d41ebfa Mon Sep 17 00:00:00 2001 From: temi Date: Wed, 28 Aug 2024 17:11:11 +1000 Subject: [PATCH] AtlasOfLivingAustralia/fieldcapture#3292 - fixes cause of some errors --- .../services/au/org/ala/ecodata/SpatialService.groovy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/grails-app/services/au/org/ala/ecodata/SpatialService.groovy b/grails-app/services/au/org/ala/ecodata/SpatialService.groovy index 78f2fc3e9..c23547cbf 100644 --- a/grails-app/services/au/org/ala/ecodata/SpatialService.groovy +++ b/grails-app/services/au/org/ala/ecodata/SpatialService.groovy @@ -166,7 +166,7 @@ class SpatialService { List checkForBoundaryIntersectionInLayers = metadataService.getGeographicConfig().checkForBoundaryIntersectionInLayers if (!mainGeometry.isValid()) { log.info("Main geometry invalid. Cannot check intersection is near boundary.") - return response + return [response, [:]] } Map filteredResponse = [:] Map intersectionAreaByFacets = [:].withDefault { [:] } @@ -241,11 +241,16 @@ class SpatialService { double intersectArea = intersection.getArea() double mainGeometryArea = mainGeometry.getArea() double proportion = 0.0 + double area = 0.0d if (mainGeometryArea != 0.0d) { proportion = intersectArea/mainGeometryArea } - [proportion, GeometryUtils.area(intersection)] + if (intersectArea != 0.0d) { + area = GeometryUtils.area(intersection) + } + + [proportion, area] } /**