public class DistanceOp extends Object
Geometrys 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.
| Constructor and Description |
|---|
DistanceOp(Geometry
Constructs a DistanceOp that computes the distance and nearest points between the two specified geometries.
|
DistanceOp(Geometry
Constructs a DistanceOp that computes the distance and nearest points between the two specified geometries.
|
| Modifier and Type | Method and Description |
|---|---|
GeometryLocation |
closestLocations()
Deprecated.
renamed to nearestLocations
|
Coordinate |
closestPoints()
Deprecated.
renamed to nearestPoints
|
static Coordinate |
closestPoints(Geometry
Deprecated.
renamed to nearestPoints
|
double |
distance()
Report the distance between the nearest points on the input geometries.
|
static double |
distance(Geometry
Compute the distance between the nearest points of two geometries.
|
static boolean |
isWithinDistance(Geometry
Test whether two geometries lie within a given distance of each other.
|
GeometryLocation |
nearestLocations()
Report the locations of the nearest points in the input geometries.
|
Coordinate |
nearestPoints()
Report the coordinates of the nearest points in the input geometries.
|
static Coordinate |
nearestPoints(Geometry
Compute the the nearest points of two geometries.
|
public DistanceOp(Geometryg0, Geometry g1)
g0 - a Geometry
g1 - a Geometry
public static double distance(Geometryg0, Geometry g1)
public static boolean isWithinDistance(Geometryg0, Geometry g1, double distance)
public static Coordinate[] nearestPoints(Geometry g0, Geometry g1)
public static Coordinate[] closestPoints(Geometry g0, Geometry g1)
public double distance()
IllegalArgumentException - if either input geometry is null
public Coordinate[] nearestPoints()
Coordinates of the nearest points
public Coordinate[] closestPoints()
Coordinates of the nearest points
public GeometryLocation[] nearestLocations()
GeometryLocations for the nearest points
public GeometryLocation[] closestLocations()
GeometryLocations for the nearest points