public class Coordinates extends Object
| Modifier and Type | Field and Description |
|---|---|
static double |
EARTH_RADIUS_EQUATORIAL
The equatorial radius of the earth as derived from the WGS-84 ellipsoid:
6378.1370 km. |
static double |
EARTH_RADIUS_MEAN
The Authalic mean radius (A
6371.0072 km. |
static double |
EARTH_RADIUS_POLAR
The polar radius of the earth as derived from the WGS-84 ellipsoid:
6356.7523 km]. |
static Range<Double> |
LAT_RANGE
Supported latitudes:
[-90..90]°. |
static Range<Double> |
LON_RANGE
Supported longitudes:
(-360..360)°. |
static double |
MINUTES_PER_DEGREE
Constant for arcminutes per degree:
60″. |
static double |
SECONDS_PER_DEGREE
Constant for arcseconds per degree:
3600′. |
| Constructor and Description |
|---|
Coordinates() |
| Modifier and Type | Method and Description |
|---|---|
static double |
checkLatitude(double latitude)
Ensure that
-90° ≤ latitude ≤ 90°. |
static double |
checkLongitude(double longitude)
Ensure that
-360° < longitude < 360°. |
static double |
degreesLatPerKm(Location location)
Return a conversion factor for the number of degrees of latitude per km at
a given
location. |
static double |
degreesLonPerKm(Location location)
Return a conversion factor for the number of degrees of longitude per km at
a given
location. |
static double |
minutesToDeg(double minutes)
Convert arc
minutes to decimal degrees. |
static double |
radiusAtLocation(Location location)
Return the radius of the earth at the latitude of the supplied
Location (see Wikipedia for source). |
static double |
secondsToDeg(double seconds)
Convert arc
seconds to decimal degrees. |
static double |
toDecimalDegrees(double degrees,
double minutes)
Convert
degrees and decimal minutes to decimal degrees. |
public static final double EARTH_RADIUS_MEAN
6371.0072 km.public static final double EARTH_RADIUS_EQUATORIAL
6378.1370 km.public static final double EARTH_RADIUS_POLAR
6356.7523 km].public static final double MINUTES_PER_DEGREE
60″.public static final double SECONDS_PER_DEGREE
3600′.public static double checkLatitude(double latitude)
-90° ≤ latitude ≤ 90°.latitude - to validateIllegalArgumentException - if latitude is outside the range
[-90..90]°public static double checkLongitude(double longitude)
-360° < longitude < 360°.longitude - to validateIllegalArgumentException - if longitude is outside the range
(-360..360)°public static double radiusAtLocation(Location location)
Location (see Wikipedia for source).location - at which to compute the earth's radiuslocationpublic static double degreesLatPerKm(Location location)
location. This can be used to convert between km-based and
degree-based grid spacing. The calculation takes into account the shape of
the earth (oblate spheroid) and scales the conversion accordingly.location - at which to compute conversion valuelocationradiusAtLocation(Location)public static double degreesLonPerKm(Location location)
location. This can be used to convert between km-based and
degree-based grid spacing. The calculation scales the degrees longitude per
km at the equator by the cosine of the supplied latitude. (Note: The
values returned are not based on the radius of curvature of the earth at
the supplied location.)location - at which to compute conversion valuelocationpublic static double secondsToDeg(double seconds)
seconds to decimal degrees.seconds - to convertpublic static double minutesToDeg(double minutes)
minutes to decimal degrees.minutes - to convertpublic static double toDecimalDegrees(double degrees,
double minutes)
degrees and decimal minutes to decimal degrees.degrees - to convertminutes - to convert