DistanceOp class

Find two points on two {@link Geometry}s which lie within a given distance, or else are the nearest points on the geometries (in which case this also provides the distance between the geometries).

The distance computation also finds a pair of points in the input geometries which have the minimum distance between them. If a point lies in the interior of a line segment, the coordinate computed is a close approximation to the exact point.

The algorithms used are straightforward O(n^2) comparisons. This worst-case performance could be improved on by using Voronoi techniques or spatial indexes.

@version 1.7

Constructors

DistanceOp(Geometry g0, Geometry g1)
Constructs a DistanceOp that computes the distance and nearest points between the two specified geometries. @param g0 a Geometry @param g1 a Geometry
DistanceOp.withTerminateDistance(Geometry g0, Geometry g1, double terminateDistance)
Constructs a DistanceOp that computes the distance and nearest points between the two specified geometries. @param g0 a Geometry @param g1 a Geometry @param terminateDistance the distance on which to terminate the search

Properties

geom List<Geometry?>
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
minDistance double
getter/setter pair
minDistanceLocation List<GeometryLocation?>?
getter/setter pair
ptLocator PointLocator
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
terminateDistance double
getter/setter pair

Methods

closestLocations() List<GeometryLocation?>?
@return a pair of {@link GeometryLocation}s for the nearest points @deprecated renamed to nearestLocations
closestPoints() List<Coordinate>
@return a pair of {@link Coordinate}s of the nearest points @deprecated renamed to nearestPoints
computeContainmentDistance() → void
computeContainmentDistance1(int polyGeomIndex, List<GeometryLocation?> locPtPoly) → void
computeContainmentDistance2(List locs, List polys, List<GeometryLocation?> locPtPoly) → void
computeContainmentDistance3(GeometryLocation ptLoc, Polygon poly, List<GeometryLocation?> locPtPoly) → void
computeFacetDistance() → void
Computes distance between facets (lines and points) of input geometries.
computeMinDistance() → void
computeMinDistanceLineLineList(LineString line0, LineString line1, List<GeometryLocation?> locGeom) → void
computeMinDistanceLinePointList(LineString line, Point pt, List<GeometryLocation?> locGeom) → void
computeMinDistanceLines(List lines0, List lines1, List<GeometryLocation?> locGeom) → void
computeMinDistanceLinesPoints(List lines, List points, List<GeometryLocation?> locGeom) → void
computeMinDistancePoints(List points0, List points1, List<GeometryLocation?> locGeom) → void
distance() double
Report the distance between the nearest points on the input geometries.
nearestLocations() List<GeometryLocation?>?
Report the locations of the nearest points in the input geometries. The locations are presented in the same order as the input Geometries.
nearestPoints() List<Coordinate>
Report the coordinates of the nearest points in the input geometries. The points are presented in the same order as the input Geometries.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateMinDistance(List<GeometryLocation?> locGeom, bool flip) → void

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

closestPointsStatic(Geometry g0, Geometry g1) List<Coordinate>
Compute the the closest points of two geometries. The points are presented in the same order as the input Geometries.
distanceStatic(Geometry g0, Geometry g1) double
Compute the distance between the nearest points of two geometries. @param g0 a {@link Geometry} @param g1 another {@link Geometry} @return the distance between the geometries
isWithinDistanceStatic(Geometry g0, Geometry g1, double distance) bool
Test whether two geometries lie within a given distance of each other. @param g0 a {@link Geometry} @param g1 another {@link Geometry} @param distance the distance to test @return true if g0.distance(g1) <= distance
nearestPointsStatic(Geometry g0, Geometry g1) List<Coordinate>
Compute the the nearest points of two geometries. The points are presented in the same order as the input Geometries.