Parameters
- geometry1
- The base geometry.
- geometry2
- The comparison geometry.
Return Value
True if the two geometries intersect.
Exception | Description |
---|---|
System.ArgumentNullException | Either geometry1 or geometry2 or both are null. |
System.NotImplementedException | The method is not implemented for GeometryBag. |
System.InvalidOperationException | Incompatible spatial references between the input geometries. |
// determine intersection between two polylines List<MapPoint> pts = new List<MapPoint>(); pts.Add(MapPointBuilderEx.CreateMapPoint(1.0, 1.0)); pts.Add(MapPointBuilderEx.CreateMapPoint(3.0, 3.0)); pts.Add(MapPointBuilderEx.CreateMapPoint(5.0, 1.0)); Polyline line1 = PolylineBuilderEx.CreatePolyline(pts); List<MapPoint> pts2 = new List<MapPoint>(); pts2.Add(MapPointBuilderEx.CreateMapPoint(1.0, 3.0)); pts2.Add(MapPointBuilderEx.CreateMapPoint(3.0, 1.0)); pts2.Add(MapPointBuilderEx.CreateMapPoint(5.0, 3.0)); Polyline line2 = PolylineBuilderEx.CreatePolyline(pts2); bool intersects = GeometryEngine.Instance.Intersects(line1, line2); // intersects = true Geometry g = GeometryEngine.Instance.Intersection(line1, line2, GeometryDimensionType.EsriGeometry0Dimension); Multipoint resultMultipoint = g as Multipoint; // result is a multiPoint that intersects at (2,2) and (4,2)
Target Platforms: Windows 11, Windows 10