GetDistanceTo

Geometry.GetDistanceTo method

Computes the minimum distance between this geometry and a specified geometry.

public double GetDistanceTo(IGeometry other)
Parameter Type Description
other IGeometry A geometry to find distance to.

Return Value

If both geometries are not IsEmpty - a distance between closest points of the geometries. If at least one geometry is empty -1 is returned.

Exceptions

exception condition
ArgumentNullException Argument is null.
ArgumentException SpatialReferenceSystem of geometries are not equivalent. You can use SpatialReferenceSystemTransformation in order to convert geometries to the same spatial reference system.

See Also