Class DistanceOp
Computes the distance and
closest points between two Geometrys.
The distance computation finds a pair of points in the input geometries
which have minimum distance between them. These points may
not be vertices of the geometries, but may lie in the interior of
a line segment. In this case the coordinate computed is a close
approximation to the exact point.
Inherited Members
Namespace: NetTopologySuite.Operation.Distance
Assembly: NetTopologySuite.dll
Syntax
public class DistanceOp
Constructors
| Edit this page View SourceDistanceOp(Geometry, Geometry)
Constructs a DistanceOp that computes the distance and closest points between the two specified geometries.
Declaration
public DistanceOp(Geometry g0, Geometry g1)
Parameters
| Type | Name | Description |
|---|---|---|
| Geometry | g0 | A geometry |
| Geometry | g1 | A geometry |
DistanceOp(Geometry, Geometry, double)
Constructs a DistanceOp that computes the distance and closest points between the two specified geometries.
Declaration
public DistanceOp(Geometry g0, Geometry g1, double terminateDistance)
Parameters
| Type | Name | Description |
|---|---|---|
| Geometry | g0 | A geometry |
| Geometry | g1 | A geometry |
| double | terminateDistance | The distance on which to terminate the search. |
Methods
| Edit this page View SourceDistance()
Report the distance between the closest points on the input geometries.
Declaration
public double Distance()
Returns
| Type | Description |
|---|---|
| double | The distance between the geometries |
Exceptions
| Type | Condition |
|---|---|
| ApplicationException | if either input geometry is null |
Distance(Geometry, Geometry)
Compute the distance between the closest points of two geometries.
Declaration
public static double Distance(Geometry g0, Geometry g1)
Parameters
| Type | Name | Description |
|---|---|---|
| Geometry | g0 | A |
| Geometry | g1 | Another |
Returns
| Type | Description |
|---|---|
| double | The distance between the geometries. |
IsWithinDistance(Geometry, Geometry, double)
Test whether two geometries lie within a given distance of each other.
Declaration
public static bool IsWithinDistance(Geometry g0, Geometry g1, double distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Geometry | g0 | |
| Geometry | g1 | |
| double | distance |
Returns
| Type | Description |
|---|---|
| bool |
NearestLocations()
Report the locations of the nearest points in the input geometries. The locations are presented in the same order as the input Geometries.
Declaration
public GeometryLocation[] NearestLocations()
Returns
| Type | Description |
|---|---|
| GeometryLocation[] | A pair of GeometryLocations for the nearest points. |
NearestPoints()
Report the coordinates of the nearest points in the input geometries. The points are presented in the same order as the input Geometries.
Declaration
public Coordinate[] NearestPoints()
Returns
| Type | Description |
|---|---|
| Coordinate[] | A pair of |
NearestPoints(Geometry, Geometry)
Compute the the closest points of two geometries. The points are presented in the same order as the input Geometries.
Declaration
public static Coordinate[] NearestPoints(Geometry g0, Geometry g1)
Parameters
| Type | Name | Description |
|---|---|---|
| Geometry | g0 | A |
| Geometry | g1 | Another |
Returns
| Type | Description |
|---|---|
| Coordinate[] | The closest points in the geometries. |