Package ucar.unidata.geoloc
Class LatLonPoints
java.lang.Object
ucar.unidata.geoloc.LatLonPoints
Static utilities for LatLonPoint.
- Since:
- 3/15/2020.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanbetweenLon(double lon, double lonBeg, double lonEnd) Test if point lies between two longitudes, deal with wrapping.static booleanSee if either coordinate inptis +/- infinite.static doublelatNormal(double lat) Normalize the latitude to lie between +/-90static StringlatToString(double lat, int ndec) Make a nicely formatted representation of a latitude, eg 40.34N or 12.9S.static doublelonDiff(double lon1, double lon2) Find difference (lon1 - lon2) normalized so that maximum value is += 180.static doublelonNormal(double lon) Normalize the longitude to lie between +/-180static doublelonNormal(double lon, double center) put longitude into the range [center +/- 180] degstatic doublelonNormal360(double lon) put longitude into the range [0, 360] degstatic doublelonNormalFrom(double lon, double start) put longitude into the range [start, start+360] degstatic StringlonToString(double lon, int ndec) Make a nicely formatted representation of a longitude, eg 120.3W or 99.99E.static doublerange180(double lon) put longitude into the range [-180, 180] degstatic StringtoString(LatLonPoint pt, int sigDigits) String representation in the form, eg 40.23N 105.1W
-
Constructor Details
-
LatLonPoints
public LatLonPoints()
-
-
Method Details
-
betweenLon
public static boolean betweenLon(double lon, double lonBeg, double lonEnd) Test if point lies between two longitudes, deal with wrapping.- Parameters:
lon- point to testlonBeg- beginning longitudelonEnd- ending longitude- Returns:
- true if lon is between lonBeg and lonEnd.
-
range180
public static double range180(double lon) put longitude into the range [-180, 180] deg- Parameters:
lon- lon to normalize- Returns:
- longitude in range [-180, 180] deg
-
lonNormal360
public static double lonNormal360(double lon) put longitude into the range [0, 360] deg- Parameters:
lon- lon to normalize- Returns:
- longitude into the range [0, 360] deg
-
lonNormal
public static double lonNormal(double lon, double center) put longitude into the range [center +/- 180] deg- Parameters:
lon- lon to normalizecenter- center point- Returns:
- longitude into the range [center +/- 180] deg
-
lonNormalFrom
public static double lonNormalFrom(double lon, double start) put longitude into the range [start, start+360] deg- Parameters:
lon- lon to normalizestart- starting point- Returns:
- longitude into the [start, start+360] deg
-
lonNormal
public static double lonNormal(double lon) Normalize the longitude to lie between +/-180- Parameters:
lon- east latitude in degrees- Returns:
- normalized lon
-
lonDiff
public static double lonDiff(double lon1, double lon2) Find difference (lon1 - lon2) normalized so that maximum value is += 180.- Parameters:
lon1- startlon2- end- Returns:
- normalized difference
-
latNormal
public static double latNormal(double lat) Normalize the latitude to lie between +/-90- Parameters:
lat- north latitude in degrees- Returns:
- normalized lat
-
latToString
Make a nicely formatted representation of a latitude, eg 40.34N or 12.9S.- Parameters:
lat- the latitude.ndec- number of digits to right of decimal point- Returns:
- String representation.
-
lonToString
Make a nicely formatted representation of a longitude, eg 120.3W or 99.99E.- Parameters:
lon- the longitude.ndec- number of digits to right of decimal point- Returns:
- String representation.
-
isInfinite
See if either coordinate inptis +/- infinite. This happens sometimes in projective geometry.- Parameters:
pt- point to check- Returns:
- true if either coordinate is +/- infinite.
-
toString
String representation in the form, eg 40.23N 105.1W- Parameters:
pt- the LatLonPointsigDigits- significant digits- Returns:
- String representation
-