From 7d1b61567eb761bf264ebee1793b64450002f7c9 Mon Sep 17 00:00:00 2001 From: chrisala Date: Thu, 13 Jun 2024 16:44:50 +1000 Subject: [PATCH] Changing to wkt due to issues parsing Features #929 --- .../services/au/org/ala/ecodata/SiteService.groovy | 2 +- .../au/org/ala/ecodata/SpatialService.groovy | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/grails-app/services/au/org/ala/ecodata/SiteService.groovy b/grails-app/services/au/org/ala/ecodata/SiteService.groovy index 8b91fb034..70c37a5ad 100644 --- a/grails-app/services/au/org/ala/ecodata/SiteService.groovy +++ b/grails-app/services/au/org/ala/ecodata/SiteService.groovy @@ -864,7 +864,7 @@ class SiteService { geographicFacets = spatialService.intersectGeometry(geom, fidsToLookup) break } - geographicFacets + geographicFacets ?: [:] } diff --git a/grails-app/services/au/org/ala/ecodata/SpatialService.groovy b/grails-app/services/au/org/ala/ecodata/SpatialService.groovy index 4d860361f..8497f9e8b 100644 --- a/grails-app/services/au/org/ala/ecodata/SpatialService.groovy +++ b/grails-app/services/au/org/ala/ecodata/SpatialService.groovy @@ -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 } /** @@ -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) @@ -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") }