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 or empty. |
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(MapPointBuilder.CreateMapPoint(1.0, 1.0)); pts.Add(MapPointBuilder.CreateMapPoint(3.0, 3.0)); pts.Add(MapPointBuilder.CreateMapPoint(5.0, 1.0)); Polyline line1 = PolylineBuilder.CreatePolyline(pts); List<MapPoint> pts2 = new List<MapPoint>(); pts2.Add(MapPointBuilder.CreateMapPoint(1.0, 3.0)); pts2.Add(MapPointBuilder.CreateMapPoint(3.0, 1.0)); pts2.Add(MapPointBuilder.CreateMapPoint(5.0, 3.0)); Polyline line2 = PolylineBuilder.CreatePolyline(pts2); bool intersects = GeometryEngine.Instance.Intersects(line1, line2); // intersects = true Geometry g = GeometryEngine.Instance.Intersection(line1, line2, GeometryDimension.esriGeometry0Dimension); Multipoint resultMultipoint = g as Multipoint; // result is a multiPoint that intersects at (2,2) and (4,2)
Target Platforms: Windows 10, Windows 8.1, Windows 7