Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- fixes cause of some errors
  • Loading branch information
temi committed Aug 28, 2024
1 parent 8cfd3fa commit 5d82180
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 @@ -165,7 +165,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 @@ -240,11 +240,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 5d82180

Please sign in to comment.