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
     
  • Method Summary

    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
    See if either coordinate in pt is +/- infinite.
    static double
    latNormal(double lat)
    Normalize the latitude to lie between +/-90
    static 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 +/-180
    static double
    lonNormal(double lon, double center)
    put longitude into the range [center +/- 180] deg
    static double
    lonNormal360(double lon)
    put longitude into the range [0, 360] deg
    static double
    lonNormalFrom(double lon, double start)
    put longitude into the range [start, start+360] deg
    static 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] deg
    static String
    toString(LatLonPoint pt, int sigDigits)
    String representation in the form, eg 40.23N 105.1W

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 test
      lonBeg - beginning longitude
      lonEnd - 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 normalize
      center - 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 normalize
      start - 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 - start
      lon2 - 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 in pt 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 LatLonPoint
      sigDigits - significant digits
      Returns:
      String representation