Skip to content

Commit

Permalink
Allow grid appear on edge and dev env
Browse files Browse the repository at this point in the history
  • Loading branch information
utas-raymondng committed Oct 2, 2024
1 parent 1434359 commit ef2366e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ public class IndexerConfig {
@Value("${app.geometry.enableGridSpatialExtents:false}")
protected boolean girdSpatialExtents;

@Value("${app.geometry.coastalPrecision:0.04}")
protected double coastalPrecision;

@PostConstruct
public void init() {
GeometryUtils.setGridSize(gridSize);
GeometryUtils.setGridSpatialExtents(girdSpatialExtents);
GeometryUtils.setCoastalPrecision(coastalPrecision);
GeometryUtils.setExecutorService(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()));

GeometryUtils.init();
}

@PreDestroy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ public class GeometryUtils {
@Setter
protected static double gridSize = 10.0;

@Getter
@Setter
protected static double coastalPrecision = 0.03;

// Load a coastline shape file so that we can get a spatial extents that cover sea only
static {
public static void init() {
try {
// shp file depends on shx, so need to have shx appear in temp folder.
saveResourceToTemp("land/ne_10m_land.shx", "shapefile.shx");
Expand All @@ -73,7 +77,7 @@ public class GeometryUtils {

// This will reduce the points of the shape file for faster processing
Geometry simplifiedGeometry = DouglasPeuckerSimplifier
.simplify(landFeatureGeometry, 0.03); // Adjust tolerance
.simplify(landFeatureGeometry, getCoastalPrecision()); // Adjust tolerance

geometries.add(simplifiedGeometry);
}
Expand Down

0 comments on commit ef2366e

Please sign in to comment.