public class Datum extends Object
A geodesic datum.
Constructor and Description |
---|
Datum(String name,
double a,
double f)
Creates a datum.
|
Datum(String name,
double a,
double f,
double k,
double dx,
double dy,
double dz,
double rx,
double ry,
double rz)
Creates a datum.
|
Modifier and Type | Method and Description |
---|---|
double |
bearing(double origLat,
double origLng,
double targetLat,
double targetLng)
Computes the bearing (forward azimuth) from one coordinate to the other.
|
double |
bearing(GeoLocation origin,
GeoLocation target)
Computes the bearing (forward azimuth) from one coordinate to the other.
|
double |
destEast(double lat0,
double lng0,
double distance)
Computes the longitude of the destination point when starting at the given location and traveling due east for a given distance (or west if distance is negative).
|
GeoLocation |
destEast(GeoLocation origin,
double distance)
Computes the destination coordinate when starting at the given location and traveling due east for a given distance (or west if the distance is negative)
|
GeoLocation |
destination(double lat0,
double lng0,
double h0,
double bearing,
double distance)
Computes the destination coordinate when starting at the given location and traveling along a given bearing for a given distance.
|
GeoLocation |
destination(GeoLocation origin,
double bearing,
double distance)
Computes the destination coordinate when starting at the given location and traveling along a given bearing for a given distance.
|
double |
destNorth(double lat0,
double distance)
Computes the latitude of the destination point when starting at the given latitude and traveling due north for a given distance (or south if distance is negative).
|
GeoLocation |
destNorth(GeoLocation origin,
double distance)
Computes the destination coordinate when starting at the given location and traveling due North for a given distance (or south if distance is negative).
|
GeoLocation |
destVincenty(double lat0,
double lng0,
double h0,
double bearing,
double distance)
Computes the destination coordinate when starting at the given location and traveling along a given bearing for a given distance, using the Vincenty formula.
|
GeoLocation |
destVincenty(GeoLocation origin,
double bearing,
double distance)
Computes the exact destination coordinate when starting at the given location and traveling along a given bearing for a given distance, using the Vincenty formula.
|
double |
distance(double lat1,
double lng1,
double h1,
double lat2,
double lng2,
double h2)
Computes the approximate geodesic great-circle distance between two coordinates.
|
double |
distance(GeoLocation loc1,
GeoLocation loc2)
Computes the approximate geodesic great-circle distance between two coordinates.
|
double |
distanceEast(double lat,
double lng1,
double alt1,
double lng2,
double alt2)
Computes the approximate geodesic great-circle East-West distance between the longitudes of the given locations at a given latitude.
|
double |
distanceEast(double lat1,
double lng1,
double alt1,
double lat2,
double lng2,
double alt2)
Computes the approximate geodesic great-circle East-West distance between the longitudes of the given locations at their mean latitude.
|
double |
distanceEast(GeoLocation loc1,
GeoLocation loc2)
Computes the approximate geodesic great-circle East-West distance between the longitudes of the given locations at their mean latitude.
|
double |
distanceHaversine(double lat1,
double lng1,
double h1,
double lat2,
double lng2,
double h2)
Computes the approximate geodesic great-circle distance between two coordinates using the Haversine formula.
|
double |
distanceHaversine(GeoLocation loc1,
GeoLocation loc2)
Computes the approximate geodesic great-circle distance between two coordinates Haversine formula.
|
double |
distanceNorth(double lat1,
double alt1,
double lat2,
double alt2)
Computes the approximate geodesic great-circle North-South distance between two latitudes.
|
double |
distanceNorth(GeoLocation loc1,
GeoLocation loc2)
Computes the approximate geodesic great-circle North-South distance between the latitudes of the given locations.
|
double |
distanceVincenty(double lat1,
double lng1,
double lat2,
double lng2)
Computes the exact geodesic great-circle distance between two coordinates using the Vincenty formula.
|
double |
distanceVincenty(GeoLocation loc1,
GeoLocation loc2)
Computes the exact geodesic great-circle distance between two coordinates Vincenty formula.
|
GeoLocation |
ecefToGeo(ECEFLocation ecf)
Translates a location given in ECEF coordinates into geographic coordinates.
|
ECEFAcceleration |
from(Datum datum,
ECEFAcceleration ecf)
Translates an acceleration vector in ECEF coordinates from the given datum to this datum
|
ECEFLocation |
from(Datum datum,
ECEFLocation ecf)
Translates the ECEF coordinates of a location on a the given datum to a location on this datum
|
ECEFVelocity |
from(Datum datum,
ECEFVelocity ecf)
Translates a velocity vector in ECEF coordinates from the given datum to this datum
|
GeoLocation |
from(Datum datum,
GeoLocation loc)
Translates the geographic coordinates of a location on a given datum to a location on this datum
|
CartLocation |
fromGeo(CoordinateSystem cs,
GeoLocation geo) |
ECEFAcceleration |
fromWGS84(ECEFAcceleration ecfW84)
Translates an acceleration vector in ECEF coordinates from the WGS84 datum to this datum
|
ECEFLocation |
fromWGS84(ECEFLocation ecfW84)
Translates the ECEF coordinates of a location on a the WGS84 datum to a location on this datum
|
ECEFVelocity |
fromWGS84(ECEFVelocity ecfW84)
Translates a velocity vector in ECEF coordinates from the WGS84 datum to this datum
|
ECEFLocation |
geoToECEF(GeoLocation geo)
Translates a location given in geographic coordinates into ECEF coordinates
|
UTMLocation |
geoToUTM(GeoLocation geo)
Translates a location in geographic coordinates to UTM coordinates
|
UTMLocation |
geoToUTM(GeoLocation geo,
int zone)
Translates a location in geographic coordinates to UTM coordinates, forcing a given UTM zone.
|
double |
getA()
The large axis of the ellipsoid (in meters)
|
double |
getF()
The oblateness factor
|
double |
getM(double lat)
Computes the meridional radius at the given latitude.
|
double |
getMeanRadius(double lat)
Computes the mean radius at the given latitude.
|
double |
getMeanRadius(double lat,
double bearing)
Computes the mean radius at the given latitude along a given bearing
|
double |
getMeanRadius(double lat1,
double lng1,
double lat2,
double lng2)
Computes a mean radius that tries to serve as a good approximation of the ellipsoid’s radius for the two given coordinate.
|
double |
getMeanRadius(GeoLocation loc1,
GeoLocation loc2)
Computes a mean radius that tries to serve as a good approximation of the ellipsoid’s radius for the two given coordinate.
|
double |
getN(double lat)
Computes the normal radius at the given latitude.
|
int |
getUTMZone(GeoLocation geo)
Computes the UTM zone of a given geographic location
|
double |
intersectLat(double d,
double lat0,
double lat)
Intersects given latitude lat with the spherical circle centered on latitude lat0 of spherical radius d.
|
GeoLocation |
toGeo(CoordinateSystem cs,
CartLocation loc) |
String |
toString() |
ECEFAcceleration |
toWGS84(ECEFAcceleration ecf)
Translates an acceleration vector in ECEF coordinates from this datum to the WGS84
|
ECEFLocation |
toWGS84(ECEFLocation ecf)
Translates the ECEF coordinates of a location on this datum to a location on the WGS84 datum
|
ECEFVelocity |
toWGS84(ECEFVelocity ecf)
Translates a velocity vector in ECEF coordinates from this datum to the WGS84
|
GeoLocation |
utmToGeo(UTMLocation utm)
Translates a location given in UTM coordinates to geographic coordinates.
|
public Datum(String name, double a, double f)
Creates a datum.
name
- the name of the datum.a
- the large axis radius of the ellipsoid (in meters)f
- The oblateness factor of the Datumpublic Datum(String name, double a, double f, double k, double dx, double dy, double dz, double rx, double ry, double rz)
Creates a datum.
name
- the name of the datum.a
- the large axis radius of the ellipsoid (in meters)f
- the oblateness factor of the Datumk
- the Bursa-Wolfe scale (with respect to WGS84)dx
- the Bursa-Wolfe X translation (with respect to WGS84)dy
- the Bursa-Wolfe Y translation (with respect to WGS84)dz
- the Bursa-Wolfe Z translation (with respect to WGS84)rx
- the Bursa-Wolfe X rotation (with respect to WGS84)ry
- the Bursa-Wolfe Y rotation (with respect to WGS84)rz
- the Bursa-Wolfe Z rotation (with respect to WGS84)public double getA()
The large axis of the ellipsoid (in meters)
public double getF()
The oblateness factor
public double getN(double lat)
Computes the normal radius at the given latitude.
lat
- the latitude in radianspublic double getM(double lat)
Computes the meridional radius at the given latitude.
lat
- the latitude in radians.public double getMeanRadius(double lat)
Computes the mean radius at the given latitude. This is the geometric mean of the normal
and meridional
radii.
lat
- the latitude in radians.public double getMeanRadius(double lat, double bearing)
Computes the mean radius at the given latitude along a given bearing
lat
- the latitude in radiansbearing
- the bearing (forward azimuth) from North, clockwise in radianspublic double getMeanRadius(GeoLocation loc1, GeoLocation loc2)
Computes a mean radius that tries to serve as a good approximation of the ellipsoid’s radius for the two given coordinate.
loc1
- the first locationloc2
- the second locationpublic double getMeanRadius(double lat1, double lng1, double lat2, double lng2)
Computes a mean radius that tries to serve as a good approximation of the ellipsoid’s radius for the two given coordinate.
lat1
- the latitude of the first location in radianslng1
- the longitude of the first location in radianslat2
- the latitude of the second location in radianslng2
- the longitude of the second location in radianspublic double distance(GeoLocation loc1, GeoLocation loc2)
Computes the approximate geodesic great-circle distance between two coordinates. This method uses a spherical approximation of the ellipsoid with the radius obtained with getMeanRadius(loc1, loc2)
.
loc1
- the first locationloc2
- the second locationpublic double distance(double lat1, double lng1, double h1, double lat2, double lng2, double h2)
Computes the approximate geodesic great-circle distance between two coordinates. This method uses a spherical approximation of the ellipsoid with the radius obtained with getMeanRadius(lat1, lng1, lat2, lng2)
.
lat1
- the latitude of the first location in radianslng1
- the longitude of the first location in radiansh1
- the altitude of the first location above/below sea-level in meterslat2
- the latitude of the second location in radianslng2
- the longitude of the second location in radiansh2
- the altitude of the second location above/below sea-level in meterspublic double distanceHaversine(GeoLocation loc1, GeoLocation loc2)
Computes the approximate geodesic great-circle distance between two coordinates Haversine formula. This method uses a spherical approximation of the ellipsoid with the radius obtained with getMeanRadius(loc1, loc2)
. This method is slower but more exact than distance()
.
loc1
- the first locationloc2
- the second locationpublic double distanceHaversine(double lat1, double lng1, double h1, double lat2, double lng2, double h2)
Computes the approximate geodesic great-circle distance between two coordinates using the Haversine formula. This method uses a spherical approximation of the ellipsoid with the radius obtained with getMeanRadius(lat1, lng1, lat2, lng2)
. This method is slower but more exact than distance()
.
lat1
- the latitude of the first location in radianslng1
- the longitude of the first location in radiansh1
- the altitude of the first location above/below sea-level in meterslat2
- the latitude of the second location in radianslng2
- the longitude of the second location in radiansh2
- the altitude of the second location above/below sea-level in meterspublic double bearing(GeoLocation origin, GeoLocation target)
Computes the bearing (forward azimuth) from one coordinate to the other. The bearing is given from the North, clockwise in radians. Note that bearing(a, b)
is not necessarily -bearing(b, a)
.
origin
- the origin coordinatetarget
- the target coordinatepublic double bearing(double origLat, double origLng, double targetLat, double targetLng)
Computes the bearing (forward azimuth) from one coordinate to the other. The bearing is given from the North, clockwise in radians. Note that bearing(a, b)
is not necessarily -bearing(b, a)
.
origLat
- the latitude of the origin coordinate in radiansorigLng
- the longitude of the origin coordinate in radianstargetLat
- the latitude of the target coordinate in radianstargetLng
- the longitude of the target coordinate in radianspublic GeoLocation destination(GeoLocation origin, double bearing, double distance)
Computes the destination coordinate when starting at the given location and traveling along a given bearing for a given distance.
origin
- the location of the starting pointbearing
- the bearing (forward azimuth) of travel, in radians, measured clockwise from the Northdistance
- the distance to travel in meterspublic GeoLocation destination(double lat0, double lng0, double h0, double bearing, double distance)
Computes the destination coordinate when starting at the given location and traveling along a given bearing for a given distance.
lat0
- the latitude of the starting point in radianslng0
- the longitude of the starting point in radiansh0
- the altitude of the starting pointbearing
- the bearing (forward azimuth) of travel, in radians, measured clockwise from the Northdistance
- the distance to travel in meterspublic double distanceVincenty(GeoLocation loc1, GeoLocation loc2)
Computes the exact geodesic great-circle distance between two coordinates Vincenty formula. This method uses a spherical approximation of the ellipsoid with the radius obtained with getMeanRadius(loc1, loc2)
. This method is much slower but much more exact than either distance()
or distanceHaversine()
.
loc1
- the first locationloc2
- the second locationpublic double distanceVincenty(double lat1, double lng1, double lat2, double lng2)
Computes the exact geodesic great-circle distance between two coordinates using the Vincenty formula. This method uses a spherical approximation of the ellipsoid with the radius obtained with getMeanRadius(lat1, lng1, lat2, lng2)
. This method is much slower but much more exact than either distance()
or distanceHaversine()
.
lat1
- the latitude of the first location in radianslng1
- the longitude of the first location in radianslat2
- the latitude of the second location in radianslng2
- the longitude of the second location in radianspublic GeoLocation destVincenty(GeoLocation origin, double bearing, double distance)
Computes the exact destination coordinate when starting at the given location and traveling along a given bearing for a given distance, using the Vincenty formula. This method is much slower, but much more exact that destination()
.
origin
- the location of the starting pointbearing
- the bearing (forward azimuth) of travel, in radians, measured clockwise from the Northdistance
- the distance to travel in meterspublic GeoLocation destVincenty(double lat0, double lng0, double h0, double bearing, double distance)
Computes the destination coordinate when starting at the given location and traveling along a given bearing for a given distance, using the Vincenty formula. This method is much slower, but much more exact that destination()
.
lat0
- the latitude of the starting point in radianslng0
- the longitude of the starting point in radiansh0
- the altitude of the starting pointbearing
- the bearing (forward azimuth) of travel, in radians, measured clockwise from the Northdistance
- the distance to travel in meterspublic GeoLocation destNorth(GeoLocation origin, double distance)
Computes the destination coordinate when starting at the given location and traveling due North for a given distance (or south if distance is negative).
origin
- the location of the starting pointdistance
- the distance to travel in meterspublic double destNorth(double lat0, double distance)
Computes the latitude of the destination point when starting at the given latitude and traveling due north for a given distance (or south if distance is negative).
lat0
- the latitude of the starting point, in radiansdistance
- the distance to travel in meterspublic GeoLocation destEast(GeoLocation origin, double distance)
Computes the destination coordinate when starting at the given location and traveling due east for a given distance (or west if the distance is negative)
origin
- the location of the starting pointdistance
- the distance to travel in meterspublic double destEast(double lat0, double lng0, double distance)
Computes the longitude of the destination point when starting at the given location and traveling due east for a given distance (or west if distance is negative).
lat0
- the latitude of the starting point, in radianslng0
- the latitude of the starting point, in radiansdistance
- the distance to travel in meterspublic double distanceNorth(GeoLocation loc1, GeoLocation loc2)
Computes the approximate geodesic great-circle North-South distance between the latitudes of the given locations. This method uses a spherical approximation of the ellipsoid with the radius obtained with getMeanRadius(loc1, loc2)
. The result is not a magnitude - it is positive if loc2
is north of loc1
, and negative if loc2
is south of loc1
.
loc1
- the first locationloc2
- the second locationloc2
is north of loc1
, negative if the other way around.public double distanceNorth(double lat1, double alt1, double lat2, double alt2)
Computes the approximate geodesic great-circle North-South distance between two latitudes. This method uses a spherical approximation of the ellipsoid with the radius obtained with getMeanRadius(loc1, loc2)
. The result is not a magnitude - it is positive if loc2
is north of loc1
, and negative if loc2
is south of loc1
.
lat1
- the latitude first location in radiansalt1
- the altitude first location above/below sea-level in meterslat2
- the latitude second location in radiansalt2
- the altitude second location above/below sea-level in meterslat2
is north of lat1
, negative if the other way around.public double distanceEast(GeoLocation loc1, GeoLocation loc2)
Computes the approximate geodesic great-circle East-West distance between the longitudes of the given locations at their mean latitude. This method uses a spherical approximation of the ellipsoid with the radius obtained with getMeanRadius(loc1, loc2)
. The result is not a magnitude - it is positive if loc2
is east of loc1
, and negative if loc2
is west of loc1
.
loc1
- the first locationloc2
- the second locationloc2
is east of loc1
, negative if the other way around.public double distanceEast(double lat1, double lng1, double alt1, double lat2, double lng2, double alt2)
Computes the approximate geodesic great-circle East-West distance between the longitudes of the given locations at their mean latitude. This method uses a spherical approximation of the ellipsoid with the radius obtained with getMeanRadius(loc1, loc2)
. The result is not a magnitude - it is positive if lng2
is east of lng1
, and negative if lng2
is west of lng1
.
lat1
- the latitude of the first location in radianslng1
- the longitude of the first location in radiansalt1
- the altitude of the first location above/below sea level in meterslat2
- the latitude of the second location in radianslng2
- the longitude of the second location in radiansalt2
- the altitude of the second location above/below sea level in meterslng2
is east of lng1
, negative if the other way around.public double distanceEast(double lat, double lng1, double alt1, double lng2, double alt2)
Computes the approximate geodesic great-circle East-West distance between the longitudes of the given locations at a given latitude. This method uses a spherical approximation of the ellipsoid with the radius obtained with getMeanRadius(loc1, loc2)
. The result is not a magnitude - it is positive if lng2
is east of lng1
, and negative if lng2
is west of lng1
.
lat
- the latitude of the both locations in radianslng1
- the longitude of the first location in radiansalt1
- the altitude of the first location above/below sea level in meterslng2
- the longitude of the second location in radiansalt2
- the altitude of the second location above/below sea level in meterslng2
is east of lng1
, negative if the other way around.public double intersectLat(double d, double lat0, double lat)
Intersects given latitude lat with the spherical circle centered on latitude lat0 of spherical radius d.
The intersections’ longitudes, given a return value X are: lon0 + X and lon0 - X, with lon0 being the circle’s center’s longitude.
d
- The circle’s radiuslat
- The latitude to intersectlat0
- The latitude of the circle’s centerpublic GeoLocation from(Datum datum, GeoLocation loc)
Translates the geographic coordinates of a location on a given datum to a location on this datum
datum
- the datum of the given locationloc
- the location to translatepublic ECEFLocation geoToECEF(GeoLocation geo)
Translates a location given in geographic coordinates into ECEF coordinates
geo
- the location in geographic coordinates.public GeoLocation ecefToGeo(ECEFLocation ecf)
Translates a location given in ECEF coordinates into geographic coordinates.
ecf
- the location in ECEF coordinates.public ECEFLocation fromWGS84(ECEFLocation ecfW84)
Translates the ECEF coordinates of a location on a the WGS84 datum to a location on this datum
ecfW84
- the location to translate, on the WGS84 datumpublic ECEFVelocity fromWGS84(ECEFVelocity ecfW84)
Translates a velocity vector in ECEF coordinates from the WGS84 datum to this datum
ecfW84
- the vector relative to the WGS84 datumpublic ECEFAcceleration fromWGS84(ECEFAcceleration ecfW84)
Translates an acceleration vector in ECEF coordinates from the WGS84 datum to this datum
ecfW84
- the vector relative to the WGS84 datumpublic ECEFLocation toWGS84(ECEFLocation ecf)
Translates the ECEF coordinates of a location on this datum to a location on the WGS84 datum
ecf
- the location to translate, on this datumpublic ECEFVelocity toWGS84(ECEFVelocity ecf)
Translates a velocity vector in ECEF coordinates from this datum to the WGS84
ecf
- the vector relative to this datumpublic ECEFAcceleration toWGS84(ECEFAcceleration ecf)
Translates an acceleration vector in ECEF coordinates from this datum to the WGS84
ecf
- the vector relative to this datumpublic ECEFLocation from(Datum datum, ECEFLocation ecf)
Translates the ECEF coordinates of a location on a the given datum to a location on this datum
datum
- the datum of the given locationecf
- the location to translate, on the given datumpublic ECEFVelocity from(Datum datum, ECEFVelocity ecf)
Translates a velocity vector in ECEF coordinates from the given datum to this datum
datum
- the datum of the given vectorecf
- the vector relative to the given datumpublic ECEFAcceleration from(Datum datum, ECEFAcceleration ecf)
Translates an acceleration vector in ECEF coordinates from the given datum to this datum
datum
- the datum of the given vectorecf
- the vector relative to the given datumpublic UTMLocation geoToUTM(GeoLocation geo)
Translates a location in geographic coordinates to UTM coordinates
geo
- the locationpublic int getUTMZone(GeoLocation geo)
Computes the UTM zone of a given geographic location
geo
- the locationpublic UTMLocation geoToUTM(GeoLocation geo, int zone)
Translates a location in geographic coordinates to UTM coordinates, forcing a given UTM zone. This method allows expanding UTM regions.
geo
- zone
- the UTM zone of the resultpublic GeoLocation utmToGeo(UTMLocation utm)
Translates a location given in UTM coordinates to geographic coordinates.
utm
- the locationpublic GeoLocation toGeo(CoordinateSystem cs, CartLocation loc)
public CartLocation fromGeo(CoordinateSystem cs, GeoLocation geo)