Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
temi committed Oct 3, 2024
2 parents a3f7d9d + afd65e8 commit 571c912
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ImportSciStarterJob {
static triggers = {
Boolean enabled = grailsApplication.config.getProperty("sciStarter.importEnabled", Boolean, true)
if (enabled) {
cron name: "every sunday", cronExpression: "0 0 0 ? * 1/7 *"
cron name: "every sunday", cronExpression: grailsApplication.config.getProperty("scistarter.cronSchedule", "0 0 0 ? * 1/7 *")
}
}

Expand Down
4 changes: 3 additions & 1 deletion grails-app/services/au/org/ala/ecodata/SiteService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,11 @@ class SiteService {
}
}
} catch (Exception e) {
log.info("Unable to get simplified project area geometry (site ${site.siteId}")
log.info("Unable to get simplified project area geometry (site ${site.siteId})", e)
}

// remove extent to not avoid total fields limit in ES
site?.remove('extent')
site
}

Expand Down
11 changes: 8 additions & 3 deletions src/main/groovy/au/org/ala/ecodata/GeometryUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem
import org.opengis.referencing.operation.MathTransform

import java.awt.geom.Point2D
import java.nio.charset.StandardCharsets

/**
* Helper class for working with site geometry.
*/
Expand All @@ -29,10 +31,13 @@ class GeometryUtils {

static Map wktToGeoJson(String wkt, int decimals = 20) {
WKTReader wktReader = new WKTReader()
Geometry geom = wktReader.read(wkt)
String geoJSON = new GeometryJSON(decimals).toString(geom)
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()
OutputStreamWriter writer = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)
def reader = new StringReader(wkt)
Geometry geom = wktReader.read(reader)
new GeometryJSON(decimals).write(geom, writer)
ObjectMapper mapper = new ObjectMapper()
return mapper.readValue(geoJSON, Map)
return mapper.readValue(outputStream.toByteArray(), Map)
}

static String wktToMultiPolygonWkt(String wkt) {
Expand Down

0 comments on commit 571c912

Please sign in to comment.