Search Results for

    Show / Hide Table of Contents

    Class IndexedFacetDistance

    Computes the distance between the facets (segments and vertices) of two Geometrys using a Branch-and-Bound algorithm. The Branch-and-Bound algorithm operates over a traversal of R-trees built on the target and the query geometries.

    This approach provides the following benefits:

    • Performance is dramatically improved due to the use of the R-tree index and the pruning due to the Branch-and-Bound approach
    • The spatial index on the target geometry is cached which allow reuse in an repeated query situation.
    Using this technique is usually much more performant than using the brute-force Distance(Geometry) when one or both input geometries are large, or when evaluating many distance computations against a single geometry.
    Inheritance
    object
    IndexedFacetDistance
    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 IndexedFacetDistance
    Remarks

    This class is thread-safe.

    Constructors

    | Edit this page View Source

    IndexedFacetDistance(Geometry)

    Creates a new distance-finding instance for a given target Geometry.

    Declaration
    public IndexedFacetDistance(Geometry g1)
    Parameters
    Type Name Description
    Geometry g1

    A Geometry, which may be of any type.

    Remarks

    Distances will be computed to all facets of the input geometry. The facets of the geometry are the discrete segments and points contained in its components.

    In the case of ILineal and IPuntal inputs, this is equivalent to computing the conventional distance.

    In the case of IPolygonal inputs, this is equivalent to computing the distance to the polygon boundaries.

    Methods

    | Edit this page View Source

    Distance(Geometry)

    Computes the distance from the base geometry to the given geometry.

    Declaration
    public double Distance(Geometry g)
    Parameters
    Type Name Description
    Geometry g

    The geometry to compute the distance to.

    Returns
    Type Description
    double

    The computed distance

    | Edit this page View Source

    Distance(Geometry, Geometry)

    Computes the distance between facets of two geometries.

    Declaration
    public static double Distance(Geometry g1, Geometry g2)
    Parameters
    Type Name Description
    Geometry g1

    A geometry

    Geometry g2

    A geometry

    Returns
    Type Description
    double

    The distance between the two geometries

    Remarks

    For geometries with many segments or points, this can be faster than using a simple distance algorithm.

    | Edit this page View Source

    IsWithinDistance(Geometry, Geometry, double)

    Tests whether the facets of two geometries lie within a given distance.

    Declaration
    public static bool IsWithinDistance(Geometry g1, Geometry g2, double distance)
    Parameters
    Type Name Description
    Geometry g1

    A geometry

    Geometry g2

    A geometry

    double distance

    The distance limit

    Returns
    Type Description
    bool

    true if two facets lie with the given distance

    | Edit this page View Source

    IsWithinDistance(Geometry, double)

    Tests whether the base geometry lies within a specified distance of the given geometry.

    Declaration
    public bool IsWithinDistance(Geometry g, double maxDistance)
    Parameters
    Type Name Description
    Geometry g

    The geometry to test

    double maxDistance

    The maximum distance to test

    Returns
    Type Description
    bool

    true if the geometry lies with the specified distance

    | Edit this page View Source

    NearestLocations(Geometry)

    Computes the nearest locations on the base geometry and the given geometry.

    Declaration
    public GeometryLocation[] NearestLocations(Geometry g)
    Parameters
    Type Name Description
    Geometry g

    Ihe geometry to compute the nearest location to.

    Returns
    Type Description
    GeometryLocation[]

    The nearest locations.

    | Edit this page View Source

    NearestPoints(Geometry)

    Computes the nearest locations on the target geometry and the given geometry.

    Declaration
    public Coordinate[] NearestPoints(Geometry g)
    Parameters
    Type Name Description
    Geometry g

    Ihe geometry to compute the nearest point to.

    Returns
    Type Description
    Coordinate[]

    The nearest points.

    | Edit this page View Source

    NearestPoints(Geometry, Geometry)

    Computes the nearest points of the facets of two geometries.

    Declaration
    public static Coordinate[] NearestPoints(Geometry g1, Geometry g2)
    Parameters
    Type Name Description
    Geometry g1

    A geometry

    Geometry g2

    A geometry

    Returns
    Type Description
    Coordinate[]

    The nearest points on the facets of the geometries

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