Geometry.Touches

Geometry.Touches method

Determines if this geometry and a specified geometry touch.

public bool Touches(IGeometry other)
ParameterTypeDescription
otherIGeometryA geometry.

Return Value

true if this geometry is “spatially touches” another geometry. false otherwise.

Exceptions

exceptioncondition
ArgumentNullExceptionArgument is null.
ArgumentExceptionOne of the geometries is invalid in such way that operation can not be finished.
ArgumentExceptionSpatialReferenceSystem of geometries are not equivalent. You can use SpatialReferenceSystemTransformation in order to convert geometries to the same spatial reference system.

Remarks

This method tests whether geometries touch each other in terms of DE-9IM intersection matrix. Two geometries touch each other if they have at least one boundary point in common, but no interior points. That is: two LineStrings touch each other if they share an endpoint, but don’t share a segment, two polygons touch each other if they share part of exterior or interior ring, but their interiors don’t overlap. This method is equivalent to:

this.Relate(other, "FT*******") || this.Relate(other, "F**T*****") || this.Relate(other, "F***T****");

See OpenGIS Simple Features Specification for more details about DE-9IM and “spatially touches” relation.

See Also