Search Results for

    Show / Hide Table of Contents

    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.

    Empty geometry collection components are ignored.

    The algorithms used are straightforward O(n^2) comparisons. This worst-case performance could be improved on by using Voronoi techniques.
    Inheritance
    object
    DistanceOp
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: NetTopologySuite.Operation.Distance
    Assembly: NetTopologySuite.dll
    Syntax
    public class DistanceOp

    Constructors

    | Edit this page View Source

    DistanceOp(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

    | Edit this page View Source

    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 Source

    Distance()

    Report the distance between the closest points on the input geometries.

    Declaration
    public double Distance()
    Returns
    Type Description
    double

    The distance between the geometries
    or 0 if either input geometry is empty.

    Exceptions
    Type Condition
    ApplicationException

    if either input geometry is null

    | Edit this page View Source

    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.

    Geometry g1

    Another Geometry.

    Returns
    Type Description
    double

    The distance between the geometries.

    | Edit this page View Source

    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
    | Edit this page View Source

    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.

    | Edit this page View Source

    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 Coordinates of the nearest points.

    | Edit this page View Source

    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.

    Geometry g1

    Another Geometry.

    Returns
    Type Description
    Coordinate[]

    The closest points in the geometries.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX