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

Check if a polyline is simple(self-intersecting) not working #306

Closed kunzhoudk closed 9 months ago

kunzhoudk commented 9 months ago

I want to verify whether a polyline is simple (non self-intersecting). However, in the following example, the polyline is self-intersecting, yet it is identified as simple and non-self-intersecting. Am I using the incorrect method, or am I applying the method incorrectly?

public static void main(String[] args) { OperatorFactoryLocal factory = OperatorFactoryLocal.getInstance(); OperatorSimplify simplifyOp = (OperatorSimplify) factory.getOperator(Operator.Type.Simplify); // Create a self-intersecting polyline Polyline poly = new Polyline(); poly.startPath(0, 0); poly.lineTo(100, 100); poly.lineTo(0, 100); poly.lineTo(100, 0); boolean result = simplifyOp.isSimpleAsFeature(poly, null, false, null, null); assertTrue(result); }

AnnYeLi commented 9 months ago

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

stolstov commented 9 months ago

@kunzhoudk The intent of the OperatorSimplify is to check if geometries are valid to be stored in Esri databases. It is allowed to have self intersections in polylines in that case. We don't provide a method to check specifically for self intersections. However, if you want to check if geometry is simple for the OGC standard, that prohibits self intersections in addition to a few other things, you can use OperatorSimplifyOGC.isSimpleOGC method.

stolstov commented 9 months ago

Closing this as designed.