I have one closed Polyline: "rectangle" and an open Polyline: "line". Both Polylines may be Z aware. What is the best way to find if the "line" intersects the "rectangle" in the XY plane? That is I want a 2D (XY) test for intersection. I do not need the actual coordinates of any intersection(s).
-
You need to intersect then and check the output. If they intersect you will get some output, otherwise you will get a null geometry.– Devdatta TengsheJan 24, 2014 at 15:42
1 Answer
Exemple in VB.NET:
Dim Rel As IRelationalOperator = CType(MyPolygon, IRelationalOperator)
Return Rel.Disjoint(MyPolyline)
I suggest not using ITopologicalOperator.Intersect, because as the ESRI doc says:
Since ArcGIS 9.2, Intersect has a larger cost - it takes longer to run the method. Therefore, it is a better approach to test if the two geometries are disjoint before calling Intersect.