From 1bc0252a82d9e63469780449f780e3fcf8586806 Mon Sep 17 00:00:00 2001 From: Randall Whitman Date: Tue, 14 Jul 2026 11:14:35 -0700 Subject: [PATCH 1/2] Deprecate coupling to Jackson-2 API (#325) --- .../java/com/esri/core/geometry/GeometryEngine.java | 10 ++++++---- .../java/com/esri/core/geometry/JsonParserReader.java | 8 ++++---- .../java/com/esri/core/geometry/SpatialReference.java | 2 ++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/esri/core/geometry/GeometryEngine.java b/src/main/java/com/esri/core/geometry/GeometryEngine.java index 99466fd2..2ba61cf4 100644 --- a/src/main/java/com/esri/core/geometry/GeometryEngine.java +++ b/src/main/java/com/esri/core/geometry/GeometryEngine.java @@ -44,6 +44,7 @@ public class GeometryEngine { /** + * @deprecated Use jsonToGeometry(String) * Imports the MapGeometry from its JSON representation. M and Z values are * not imported from JSON representation. * @@ -55,6 +56,7 @@ public class GeometryEngine { * @return The MapGeometry instance containing the imported geometry and its * spatial reference. */ + @Deprecated public static MapGeometry jsonToGeometry(JsonParser json) { MapGeometry geom = OperatorImportFromJson.local().execute(Geometry.Type.Unknown, new JsonParserReader(json)); return geom; @@ -95,11 +97,11 @@ public static MapGeometry jsonToGeometry(String json) { } /** - * Exports the specified geometry instance to it's JSON representation. + * Exports the specified geometry instance to its JSON representation. * * See OperatorExportToJson. * - * @see GeometryEngine#geometryToJson(SpatialReference spatialiReference, + * @see GeometryEngine#geometryToJson(SpatialReference spatialReference, * Geometry geometry) * @param wkid * The spatial reference Well Known ID to be used for the JSON @@ -114,7 +116,7 @@ public static String geometryToJson(int wkid, Geometry geometry) { } /** - * Exports the specified geometry instance to it's JSON representation. M + * Exports the specified geometry instance to its JSON representation. M * and Z values are not imported from JSON representation. * * See OperatorExportToJson. @@ -177,7 +179,7 @@ public static String geometryToGeoJson(int wkid, Geometry geometry) { } /** - * Exports the specified geometry instance to it's JSON representation. + * Exports the specified geometry instance to its JSON representation. * * See OperatorImportFromGeoJson. * diff --git a/src/main/java/com/esri/core/geometry/JsonParserReader.java b/src/main/java/com/esri/core/geometry/JsonParserReader.java index 90427c63..5313c0ab 100644 --- a/src/main/java/com/esri/core/geometry/JsonParserReader.java +++ b/src/main/java/com/esri/core/geometry/JsonParserReader.java @@ -27,9 +27,10 @@ import com.fasterxml.jackson.core.*; /** - * A throw in JsonReader built around the Jackson JsonParser. - * + * @deprecated Intended for internal use by geometry-api-java only. + * A throw-in JsonReader built around Jackson. */ +@Deprecated public class JsonParserReader implements JsonReader { private JsonParser m_jsonParser; @@ -46,7 +47,7 @@ public static JsonReader createFromString(String str) { try { JsonFactory factory = new JsonFactory(); JsonParser jsonParser = factory.createParser(str); - + jsonParser.nextToken(); return new JsonParserReader(jsonParser); } @@ -168,4 +169,3 @@ else if (t == Token.VALUE_FALSE) throw new JsonGeometryException("Not a boolean"); } } - diff --git a/src/main/java/com/esri/core/geometry/SpatialReference.java b/src/main/java/com/esri/core/geometry/SpatialReference.java index 4c337e27..26e6c562 100644 --- a/src/main/java/com/esri/core/geometry/SpatialReference.java +++ b/src/main/java/com/esri/core/geometry/SpatialReference.java @@ -74,6 +74,7 @@ boolean isLocal() { } /** + * @deprecated Use fromJson(String) * Returns spatial reference from the JsonParser. * * @param parser @@ -83,6 +84,7 @@ boolean isLocal() { * @throws Exception * if parsing has failed */ + @Deprecated public static SpatialReference fromJson(JsonParser parser) throws Exception { return fromJson(new JsonParserReader(parser)); } From 539f032fd605b3bdfd025bdddb867b82a75f64a1 Mon Sep 17 00:00:00 2001 From: Sergey Tolstov Date: Fri, 17 Jul 2026 19:39:00 -0700 Subject: [PATCH 2/2] Fix invalid check of envelope intersect for path envelopes --- .../com/esri/core/geometry/RelationalOperations.java | 2 +- .../java/com/esri/core/geometry/TestIntersect2.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/esri/core/geometry/RelationalOperations.java b/src/main/java/com/esri/core/geometry/RelationalOperations.java index abf03372..34fdd216 100644 --- a/src/main/java/com/esri/core/geometry/RelationalOperations.java +++ b/src/main/java/com/esri/core/geometry/RelationalOperations.java @@ -1609,7 +1609,7 @@ private static boolean polylineDisjointPolyline_(Polyline polyline_a, PairwiseIntersectorImpl intersector_paths = new PairwiseIntersectorImpl(multi_path_impl_a, multi_path_impl_b, tolerance, true); if (!intersector_paths.next()) - return false; + return true; return !linearPathIntersectsLinearPath_(polyline_a, polyline_b, tolerance); diff --git a/src/test/java/com/esri/core/geometry/TestIntersect2.java b/src/test/java/com/esri/core/geometry/TestIntersect2.java index 36860635..0254dcb8 100644 --- a/src/test/java/com/esri/core/geometry/TestIntersect2.java +++ b/src/test/java/com/esri/core/geometry/TestIntersect2.java @@ -25,6 +25,7 @@ package com.esri.core.geometry; import com.esri.core.geometry.Geometry.Type; +import com.esri.core.geometry.ogc.OGCGeometry; import junit.framework.TestCase; import org.junit.Test; @@ -39,6 +40,16 @@ protected void tearDown() throws Exception { super.tearDown(); } + @Test + public void testIntersectsLinestringAndMultilinestring() { + // https://github.com/Esri/geometry-api-java/issues/326 + OGCGeometry line = OGCGeometry.fromText("LINESTRING(1 0, 1 1)"); + OGCGeometry multiLine = OGCGeometry.fromText("MULTILINESTRING((0 0, 0 1), (2 0, 2 1))"); + + assertFalse(line.intersects(multiLine)); + assertFalse(multiLine.intersects(line)); + } + @Test /** * Intersect