Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- fixed issue with geometry collection wkt intersection error
  • Loading branch information
temi committed Sep 17, 2024
1 parent 5d82180 commit 5cc40f5
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 @@ -69,9 +69,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 5cc40f5

Please sign in to comment.