Class TLcdUPSUtil

java.lang.Object
com.luciad.view.map.TLcdUPSUtil

public class TLcdUPSUtil extends Object
A utility class that can be used to format and parse lon lat points to/from a UPS string.

An example of a UPS string is "Z 2181646 1704304". This String has the following components :

  • The UPS zone. In the example string this is "Z".
  • The easting, in meters.
  • The northing, in meters.
There should always be a space between the latitude letter and the easting, and between the easting and the northing.

Note : The UPS strings formatted and parsed by this class are no UPS Mgrs Strings. To format or parse UPS Mgrs strings, see TLcdUpsMgrsUtil.

Since:
2012.1
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new TLcdUPSUtil instance that uses the WGS_84 ellipsoid for its calculations.
    Creates a new TLcdUPSUtil instance that uses the given ellipsoid for its calculations.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of digits used to format a UPS String.
    char
    Returns the character to separate the zone/grid letters and the coordinates.
    lonLat2Ups(ILcdPoint aLonLatPoint)
    This method converts the given lon lat point to a UPS String.
    void
    setNumberOfDigits(int aNumberOfDigits)
    Sets the number of digits used to format a UPS String.
    void
    setUPSCoordinateSeparator(char aUPSCoordinateSeparator)
    Set the character to separate the zone/grid letters and the coordinates and between the coordinates.
    void
    ups2LonLat(String aUpsString, ILcd2DEditablePoint a2DPointSFCT)
    Finds the geodetic coordinate associated with the given UPS formatted string.
    upsXY2Ups(double aEasting, double aNorthing, boolean aNorthPole)
    Returns the formatted notation for a given coordinate within the Universal Polar Stereographic grid system.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TLcdUPSUtil

      public TLcdUPSUtil()
      Creates a new TLcdUPSUtil instance that uses the WGS_84 ellipsoid for its calculations.
    • TLcdUPSUtil

      public TLcdUPSUtil(ILcdEllipsoid aEllipsoid)
      Creates a new TLcdUPSUtil instance that uses the given ellipsoid for its calculations.
      Parameters:
      aEllipsoid - a given ellipsoid.
  • Method Details

    • getUPSCoordinateSeparator

      public char getUPSCoordinateSeparator()
      Returns the character to separate the zone/grid letters and the coordinates.
      Returns:
      the character to separate the zone/grid letters and the coordinates.
      See Also:
    • setUPSCoordinateSeparator

      public void setUPSCoordinateSeparator(char aUPSCoordinateSeparator)
      Set the character to separate the zone/grid letters and the coordinates and between the coordinates. Set the value 0 (not the character '0') to have no spaces between the zone and the coordinates.

      By default, the coordinate separator is ' ' (a space).

      Parameters:
      aUPSCoordinateSeparator - the character to separate the zone/grid letters and the coordinates and between the coordinates.
      See Also:
    • getNumberOfDigits

      public int getNumberOfDigits()
      Returns the number of digits used to format a UPS String.
      Returns:
      the number of digits used to format a UPS String.
      See Also:
    • setNumberOfDigits

      public void setNumberOfDigits(int aNumberOfDigits)
      Sets the number of digits used to format a UPS String. When the number of digits used is 7, the String has a precision of 1m. When the number of digits used is 6, the precision is 10m, etc...

      By default, no fixed number of digits is used. E.g.

      • When not calling this method, a point will be formatted as "Z 2181646 1704304"
      • When calling this method with a number of digits 7, the same point will be formatted as "Z 2181646 1704304"
      • When calling this method with a number of digits 4, the same point will be formatted as "Z 2181 1704"
      Parameters:
      aNumberOfDigits - the number of digits used to format a String.
    • lonLat2Ups

      public String lonLat2Ups(ILcdPoint aLonLatPoint) throws TLcdOutOfBoundsException
      This method converts the given lon lat point to a UPS String.
      Parameters:
      aLonLatPoint - a lon lat point.
      Returns:
      an UPS String.
      Throws:
      TLcdOutOfBoundsException - when the given point is outside the UPS bounds.
    • ups2LonLat

      public void ups2LonLat(String aUpsString, ILcd2DEditablePoint a2DPointSFCT) throws ParseException
      Finds the geodetic coordinate associated with the given UPS formatted string.
      Parameters:
      aUpsString - a UPS formatted string.
      a2DPointSFCT - a geodetic point that will be set to the coordinates of the given String
      Throws:
      ParseException - if aUpsString is not a valid UPS String.
    • upsXY2Ups

      public String upsXY2Ups(double aEasting, double aNorthing, boolean aNorthPole) throws TLcdOutOfBoundsException
      Returns the formatted notation for a given coordinate within the Universal Polar Stereographic grid system. A flag indicates whether the coordinate is within the northern or the southern UPS grid system.
      Parameters:
      aEasting - the easting of the coordinate.
      aNorthing - the northing of the coordinate.
      aNorthPole - if true, the coordinate is specified within the northern UPS grid system, and within the southern UPS grid system otherwise.
      Returns:
      the formatted notation for a given coordinate within the UPS grid system.
      Throws:
      TLcdOutOfBoundsException - if the coordinate is out of bounds.