Esri / geometry-api-java

The Esri Geometry API for Java enables developers to write custom applications for analysis of spatial data. This API is used in the Esri GIS Tools for Hadoop and other 3rd-party data processing solutions.
Apache License 2.0
694 stars 260 forks source link

On the Problem of Finding Intersection Points for Polylines #320

Open lxqaoliao opened 6 months ago

lxqaoliao commented 6 months ago

Why is the following code not a point but a line: SpatialReference s = SpatialReference.create(4450);

    Polyline lineA = new Polyline();
    lineA.startPath(new Point(352908.85 , 3422574.91));
    lineA.lineTo(new Point(352910.00, 3422580.00));

    Polyline lineB = new Polyline();
    lineB.startPath(new Point(352921.52 , 3422543.38));
    lineB.lineTo(new Point(352908.85 , 3422574.91));

    Geometry intersection = GeometryEngine.intersect(lineA, lineB, s);
    Geometry.Type type = intersection.getType();
    System.out.println();
stolstov commented 6 months ago

@lxqaoliao Use OperatorIntersection instead https://github.com/Esri/geometry-api-java/blob/e237fc0fe4a7fb43583dd335d58e1f23ab18ac4b/src/main/java/com/esri/core/geometry/OperatorIntersection.java#L73 See similar issue https://github.com/Esri/geometry-api-java/issues/301