Skip to content

Commit

Permalink
Merge pull request #1015 from AtlasOfLivingAustralia/feature/issue3292
Browse files Browse the repository at this point in the history
modified geometry collection intersection logic
  • Loading branch information
chrisala authored Sep 17, 2024
2 parents 14fa38a + 11b6dcc commit bf1de90
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions grails-app/services/au/org/ala/ecodata/SpatialService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,26 @@ class SpatialService {
Map result = [:]
fieldIds.each { fid ->
start = end
Map response = webService.doPost(url+fid, wkt)
if (response.resp && !response.error) {
result[fid] = response.resp
Map response
if (geo.geometryType == 'GeometryCollection') {
Map<String, Map> geometryCollectionIntersections = [:]
GeometryCollection geometryCollection = (GeometryCollection)geo
for (int i=0; i<geometryCollection.numGeometries; i++) {
Geometry geometryN = geometryCollection.getGeometryN(i)
String wktGeometryN = geometryN.toText()
response = webService.doPost(url+fid, wktGeometryN)
if (response.resp && !response.error) {
response.resp?.each {geometryCollectionIntersections[it.pid] = it }
}
}

result[fid] = geometryCollectionIntersections.values()?.toList()
}
else {
response = webService.doPost(url+fid, wkt)
if (response.resp && !response.error) {
result[fid] = response.resp
}
}
end = System.currentTimeMillis()
log.info("Time taken to intersect with layer $fid: ${end-start}ms")
Expand Down

0 comments on commit bf1de90

Please sign in to comment.