public class GeoDistanceUtils extends Object
Modifier and Type | Field and Description |
---|---|
static double |
DISTANCE_PCT_ERR
error threshold for point-distance queries (in percent) NOTE: Guideline from USGS is 0.005
|
Modifier and Type | Method and Description |
---|---|
static void |
closestPointOnBBox(double rMinX,
double rMinY,
double rMaxX,
double rMaxY,
double lon,
double lat,
double[] closestPt)
Finds the closest point within a rectangle (defined by rMinX, rMinY, rMaxX, rMaxY) to the given (lon, lat) point
the result is provided in closestPt.
|
static double |
distanceToDegreesLat(double lat,
double distance)
Compute the inverse haversine to determine distance in degrees longitude for provided distance in meters
|
static double |
distanceToDegreesLon(double lat,
double distance)
Compute the inverse haversine to determine distance in degrees longitude for provided distance in meters
|
static double |
haversin(double lat1,
double lon1,
double lat2,
double lon2)
Compute the great-circle distance using original haversine implementation published by Sinnot in:
R.W.
|
static double |
linearDistance(double[] pt1,
double[] pt2)
Computes distance between two points in a cartesian (x, y, {z - optional}) coordinate system
|
static double |
maxRadialDistanceMeters(double centerLon,
double centerLat)
Returns the maximum distance/radius (in meters) from the point 'center' before overlapping
|
static double |
vincentyDistance(double lonA,
double latA,
double lonB,
double latB)
Compute the distance between two geo-points using vincenty distance formula
Vincenty uses the oblate spheroid whereas haversine uses unit sphere, this will give roughly
22m better accuracy (in worst case) than haversine
|
public static final double DISTANCE_PCT_ERR
public static double haversin(double lat1, double lon1, double lat2, double lon2)
SloppyMath.haversin(double, double, double, double)
in that it uses the semi-major axis
of the earth instead of an approximation based on the average latitude of the two points (which can introduce an
additional error up to .337%, or ~67.6 km at the equator)public static final double vincentyDistance(double lonA, double latA, double lonB, double latB)
lonA
- longitudinal coordinate of point A (in degrees)latA
- latitudinal coordinate of point A (in degrees)lonB
- longitudinal coordinate of point B (in degrees)latB
- latitudinal coordinate of point B (in degrees)public static double linearDistance(double[] pt1, double[] pt2)
public static double distanceToDegreesLon(double lat, double distance)
lat
- latitude to compute delta degrees londistance
- distance in meters to convert to degrees lonpublic static void closestPointOnBBox(double rMinX, double rMinY, double rMaxX, double rMaxY, double lon, double lat, double[] closestPt)
public static double maxRadialDistanceMeters(double centerLon, double centerLat)
public static double distanceToDegreesLat(double lat, double distance)
lat
- latitude to compute delta degrees londistance
- distance in meters to convert to degrees lonCopyright © 2000-2017 Apache Software Foundation. All Rights Reserved.