Parameters
- geometry1
- The base geometry.
- geometry2
- The comparison geometry.
Return Value
True if geometry1 touches geometry2.
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. |
// two disjoint polygons Envelope env = EnvelopeBuilderEx.CreateEnvelope(MapPointBuilderEx.CreateMapPoint(4.0, 4.0), MapPointBuilderEx.CreateMapPoint(8, 8)); Polygon poly1 = PolygonBuilderEx.CreatePolygon(env); Envelope env2 = EnvelopeBuilderEx.CreateEnvelope(MapPointBuilderEx.CreateMapPoint(1.0, 1.0), MapPointBuilderEx.CreateMapPoint(5, 5)); Polygon poly2 = PolygonBuilderEx.CreatePolygon(env2); bool touches = GeometryEngine.Instance.Touches(poly1, poly2); // touches = false // another polygon that touches the first Envelope env3 = EnvelopeBuilderEx.CreateEnvelope(MapPointBuilderEx.CreateMapPoint(1.0, 1.0), MapPointBuilderEx.CreateMapPoint(4, 4)); Polygon poly3 = PolygonBuilderEx.CreatePolygon(env3); touches = GeometryEngine.Instance.Touches(poly1, poly3); // touches = true
Target Platforms: Windows 11, Windows 10