From 50f2603416f4027df1bffed54017bfab16a33ae5 Mon Sep 17 00:00:00 2001 From: utas-raymondng <manfai.ng@utas.edu.au> Date: Tue, 4 Jun 2024 14:25:50 +1000 Subject: [PATCH] update due to PR --- .../java/au/org/aodn/esindexer/utils/GeometryUtils.java | 7 ------- .../main/java/au/org/aodn/esindexer/utils/StacUtils.java | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/indexer/src/main/java/au/org/aodn/esindexer/utils/GeometryUtils.java b/indexer/src/main/java/au/org/aodn/esindexer/utils/GeometryUtils.java index 9f46cfa3..956b4ab2 100644 --- a/indexer/src/main/java/au/org/aodn/esindexer/utils/GeometryUtils.java +++ b/indexer/src/main/java/au/org/aodn/esindexer/utils/GeometryUtils.java @@ -21,13 +21,6 @@ public class GeometryUtils { protected static ObjectMapper objectMapper = new ObjectMapper(); - protected static boolean areCollinear(Coordinate p1, Coordinate p2, Coordinate p3) { - // Use the area of the triangle method to check collinearity - double area = p1.x * (p2.y - p3.y) + - p2.x * (p3.y - p1.y) + - p3.x * (p1.y - p2.y); - return area == 0; - } /** * * @param polygons - Assume to be EPSG:4326, as GeoJson always use this encoding. diff --git a/indexer/src/main/java/au/org/aodn/esindexer/utils/StacUtils.java b/indexer/src/main/java/au/org/aodn/esindexer/utils/StacUtils.java index a41e35df..3a10f3e8 100644 --- a/indexer/src/main/java/au/org/aodn/esindexer/utils/StacUtils.java +++ b/indexer/src/main/java/au/org/aodn/esindexer/utils/StacUtils.java @@ -58,7 +58,7 @@ public static List<List<BigDecimal>> createStacBBox(List<List<Geometry>> listOfP for (Geometry polygon : polygons) { // Add polygon one by one to expand the overall bounding box area, this is requirement // of STAC to have an overall bounding box of all smaller area as the first bbox in the list. - if (polygon != null) { + if (polygon != null && polygon.getEnvelopeInternal() != null) { overallBoundingBox.expandToInclude(polygon.getEnvelopeInternal()); hasBoundingBoxUpdate.set(true); } @@ -80,7 +80,7 @@ public static List<List<BigDecimal>> createStacBBox(List<List<Geometry>> listOfP final Envelope individualEnvelope = new Envelope(); for (Geometry p : polygons) { - if (p != null) { + if (p != null && p.getEnvelopeInternal() != null) { individualEnvelope.expandToInclude(p.getEnvelopeInternal()); } }