Package org.n52.io.crs
Class WGS84Util
- java.lang.Object
-
- org.n52.io.crs.WGS84Util
-
public class WGS84Util extends Object
Some utility methods for WGS84 points. Note that all calculations are being made by assuming a spherical shape of the earth (not elliptic). TheEARTH_MEAN_RADIUSis used as radius.
-
-
Field Summary
Fields Modifier and Type Field Description protected static doubleEARTH_MEAN_RADIUSThe mean radius of WGS84 ellipse.static StringEPSG_4326
-
Constructor Summary
Constructors Constructor Description WGS84Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doublegetLatitudeDelta(double distance)Calculates the latitude delta from a point from a given distance.(package private) static doublegetLatitutesCircleRadius(double latitude)static doublegetLongitudeDelta(double latitude, double distance)Calculates the longitude delta for a given distance.static doublenormalizeLatitude(double latitude)Normalizes given latitude to bounds [-90.0,90.0].static doublenormalizeLongitude(double longitude)Normalizes given longitude to bounds [-180.0,180.0].static doubleshortestDistanceBetween(org.locationtech.jts.geom.Point a, org.locationtech.jts.geom.Point b)Calculates the shortest distance between two points on a great circle.
-
-
-
Field Detail
-
EPSG_4326
public static final String EPSG_4326
- See Also:
- Constant Field Values
-
EARTH_MEAN_RADIUS
protected static final double EARTH_MEAN_RADIUS
The mean radius of WGS84 ellipse.- See Also:
- Constant Field Values
-
-
Method Detail
-
shortestDistanceBetween
public static double shortestDistanceBetween(org.locationtech.jts.geom.Point a, org.locationtech.jts.geom.Point b)Calculates the shortest distance between two points on a great circle.- Parameters:
a- a point.b- another point.- Returns:
- the shortest distance between point A and point B.
-
getLongitudeDelta
public static double getLongitudeDelta(double latitude, double distance)Calculates the longitude delta for a given distance.- Parameters:
latitude- the latitude in radians to calculate the distance delta from.distance- the distance in kilometer.- Returns:
- the longitude delta in degrees.
-
getLatitudeDelta
public static double getLatitudeDelta(double distance)
Calculates the latitude delta from a point from a given distance.- Parameters:
distance- the distance in kilometer.- Returns:
- the latitude delta in degrees.
-
getLatitutesCircleRadius
static double getLatitutesCircleRadius(double latitude)
- Parameters:
latitude- in degrees in radians.- Returns:
- the length of the latitude radius.
-
normalizeLongitude
public static double normalizeLongitude(double longitude)
Normalizes given longitude to bounds [-180.0,180.0].- Parameters:
longitude- in degrees.- Returns:
- the normalized longitude.
-
normalizeLatitude
public static double normalizeLatitude(double latitude)
Normalizes given latitude to bounds [-90.0,90.0].- Parameters:
latitude- in degrees.- Returns:
- the normalized latitude.
-
-