java.lang.Objectcom.ulocate.api.geo.GeoCalc
public class GeoCalc
GeoCalc provides functions for distance calculations between two points on the earth's surface.
The functions give results that should be accurate enough for any LBS application.
The most accurate function provided here is based on a sphere.
| Field Summary | |
|---|---|
static double |
EARTH_RADIUS
Average earth radius in miles. |
static double |
FEET
Unit of measurement value for feet. |
static double |
KILOMETERS
Unit of measurement value for kilometers. |
static double |
METERS
Unit of measurement value for meters. |
static double |
MILES
Unit of measurement value for miles. |
static double |
MILES_PER_DEGREE_LATITUDE
Miles per degree of Latitude. |
static double |
YARDS
Unit of measurement value for yards. |
| Constructor Summary | |
|---|---|
GeoCalc()
|
|
| Method Summary | |
|---|---|
double |
getDistanceAccurate(double lon1,
double lat1,
double lon2,
double lat2,
double uom)
Calculates the distance between two points (given by Latitude and Longitude). |
double |
getDistanceApproximate(double lon1,
double lat1,
double lon2,
double lat2,
double uom)
Calculates an estimated distance between two points (given by Latitude and Longitude). |
double |
getDistanceRough(double lon1,
double lat1,
double lon2,
double lat2,
double uom)
Calculates an estimated distance between two points (given by Latitude and Longitude). |
double |
getMilesPerDegreeLongitude(double latitude)
Calculates the number of miles per degree of Longitude at a given Latitude. |
double[] |
getSearchMBR(double distance,
double uom,
double longitude,
double latitude)
Calculates the minimum bounding rectangle of the search area. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double EARTH_RADIUS
public static final double FEET
public static final double KILOMETERS
public static final double METERS
public static final double MILES
public static final double MILES_PER_DEGREE_LATITUDE
public static final double YARDS
| Constructor Detail |
|---|
public GeoCalc()
| Method Detail |
|---|
public double getDistanceAccurate(double lon1,
double lat1,
double lon2,
double lat2,
double uom)
lon1 - Longitude of point 1.lat1 - Latitude of point 1.lon2 - Longitude of point 2.lat2 - Latitude of point 2.uom - Unit of measurement.
public double getDistanceApproximate(double lon1,
double lat1,
double lon2,
double lat2,
double uom)
lon1 - Longitude of point 1.lat1 - Latitude of point 1.lon2 - Longitude of point 2.lat2 - Latitude of point 2.uom - Unit of measurement.
public double getDistanceRough(double lon1,
double lat1,
double lon2,
double lat2,
double uom)
lon1 - Longitude of point 1.lat1 - Latitude of point 1.lon2 - Longitude of point 2.lat2 - Latitude of point 2.uom - Unit of measurement.
public double getMilesPerDegreeLongitude(double latitude)
latitude -
public double[] getSearchMBR(double distance,
double uom,
double longitude,
double latitude)
distance - Search distance.uom - Unit of measurement for search distance.longitude - Longitude of the search center.latitude - Latitude of the search center.