Package ucar.unidata.geoloc
Class LatLonPoints
- java.lang.Object
-
- ucar.unidata.geoloc.LatLonPoints
-
public class LatLonPoints extends Object
Static utilities for LatLonPoint.- Since:
- 3/15/2020.
-
-
Constructor Summary
Constructors Constructor Description LatLonPoints()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
betweenLon(double lon, double lonBeg, double lonEnd)
Test if point lies between two longitudes, deal with wrapping.static boolean
isInfinite(ProjectionPoint pt)
See if either coordinate inpt
is +/- infinite.static double
latNormal(double lat)
Normalize the latitude to lie between +/-90static String
latToString(double lat, int ndec)
Make a nicely formatted representation of a latitude, eg 40.34N or 12.9S.static double
lonDiff(double lon1, double lon2)
Find difference (lon1 - lon2) normalized so that maximum value is += 180.static double
lonNormal(double lon)
Normalize the longitude to lie between +/-180static double
lonNormal(double lon, double center)
put longitude into the range [center +/- 180] degstatic double
lonNormal360(double lon)
put longitude into the range [0, 360] degstatic double
lonNormalFrom(double lon, double start)
put longitude into the range [start, start+360] degstatic String
lonToString(double lon, int ndec)
Make a nicely formatted representation of a longitude, eg 120.3W or 99.99E.static double
range180(double lon)
put longitude into the range [-180, 180] degstatic String
toString(LatLonPoint pt, int sigDigits)
String representation in the form, eg 40.23N 105.1W
-
-
-
Method Detail
-
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
public static String latToString(double lat, int ndec)
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
public static String lonToString(double lon, int ndec)
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
public static boolean isInfinite(ProjectionPoint pt)
See if either coordinate inpt
is +/- infinite. This happens sometimes in projective geometry.- Parameters:
pt
- point to check- Returns:
- true if either coordinate is +/- infinite.
-
toString
public static String toString(LatLonPoint pt, int sigDigits)
String representation in the form, eg 40.23N 105.1W- Parameters:
pt
- the LatLonPointsigDigits
- significant digits- Returns:
- String representation
-
-