Skip to content

Commit

Permalink
Merge pull request #1004 from AtlasOfLivingAustralia/feature/issue3292-2
Browse files Browse the repository at this point in the history
fixes two exceptions updating site metadata - AtlasOfLivingAustralia/fieldcapture#3292
  • Loading branch information
chrisala authored Aug 28, 2024
2 parents c8d39b1 + e4867f9 commit c2d997f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions grails-app/services/au/org/ala/ecodata/SpatialService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 { [:] }
Expand Down Expand Up @@ -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]
}

/**
Expand Down

0 comments on commit c2d997f

Please sign in to comment.