Skip to content

Commit

Permalink
Changing to wkt due to issues parsing Features #929
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Jun 13, 2024
1 parent e6665b9 commit 7d1b615
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion grails-app/services/au/org/ala/ecodata/SiteService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ class SiteService {
geographicFacets = spatialService.intersectGeometry(geom, fidsToLookup)
break
}
geographicFacets
geographicFacets ?: [:]

}

Expand Down
13 changes: 9 additions & 4 deletions grails-app/services/au/org/ala/ecodata/SpatialService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ class SpatialService {
log.info("Time taken to filter out objects in boundary: ${end-start}ms")

start = end
convertResponsesToGeographicFacets(result)
Map geographicFacets = convertResponsesToGeographicFacets(result)
end = System.currentTimeMillis()
log.info("Time taken to convert responses to geographic facets: ${end-start}ms")

geographicFacets
}

/**
Expand Down Expand Up @@ -143,6 +143,7 @@ class SpatialService {
matchingObjects.each { Map obj ->
String boundaryPid = obj.pid
if (boundaryPid) {
log.debug("Intersecting ${obj.fieldname}(${fid}) - ${obj.name} ")
// Get geoJSON of the object stored in spatial portal
long start = System.currentTimeMillis()
// def boundaryGeoJson = getGeoJsonForPidToMap(boundaryPid)
Expand All @@ -151,15 +152,19 @@ class SpatialService {
//
// start = end
// Geometry boundaryGeometry = GeometryUtils.geoJsonMapToGeometry(boundaryGeoJson)
Geometry boundaryGeometry = getGeoJsonForPidToGeometry(boundaryPid)
def proxy = grailsApplication.mainContext.spatialService
Geometry boundaryGeometry = proxy.getGeoJsonForPidToGeometry(boundaryPid)
long end = System.currentTimeMillis()
log.debug("Time taken to convert geojson to geometry for pid $boundaryPid: ${end-start}ms")

if (boundaryGeometry.isValid()) {
// check if intersection should be ignored
start = end
if (!isValidGeometryIntersection(mainGeometry, boundaryGeometry))
if (!isValidGeometryIntersection(mainGeometry, boundaryGeometry)) {
pidToFilter.add(boundaryPid)
log.debug("Filtered out ${obj.fieldname}(${fid}) - ${obj.name}")
}

end = System.currentTimeMillis()
log.debug("Time taken to check intersection for pid $boundaryPid: ${end-start}ms")
}
Expand Down

0 comments on commit 7d1b615

Please sign in to comment.