Class TLcdUpsMgrsUtil

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

public class TLcdUpsMgrsUtil extends Object
Utility class to format coordinates into UPS-MGRS notation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new TLcdUpsMgrsUtil that uses the WGS_84 ellipsoid.
    Creates a new TLcdUpsMgrsUtil that uses the given ellipsoid.
  • Method Summary

    Modifier and Type
    Method
    Description
    char
    Returns the character to separate the zone and the coordinates.
    char
    Returns the character to separate the UPS grid zone and the 100km squares.
    lonLat2UpsMgrs(ILcdPoint aLonLatPoint, int aNumberOfDigits)
    Converts a lon-lat point (WGS84) into Military Grid System coordinates for a UPS projection.
    void
    setUPSCoordinateSeparator(char aUPSCoordinateSeparator)
    Set the character to separate the zone and the coordinates and between the coordinates.
    void
    setZoneSeparator(char aZoneSeparator)
    Sets the character to use as separator between the UPS grid zone and the 100km squares.
    void
    upsMgrs2LonLat(String aUpsMgrsCell, ILcd2DEditablePoint a2DPointSFCT)
    Finds the geodetic coordinates of the lower-left corner of a square cell expressed in the MGRS Universal polar Stereographic notation.
    void
    upsMgrs2UpsXY(String aUpsMgrsCell, ILcd2DEditablePoint a2DPointSFCT)
    Finds the grid coordinates of the lower-left corner of a square cell expressed in the MGRS Universal polar Stereographic notation.
    upsXY2UpsMgrs(double aEasting, double aNorthing, boolean aNorthernHemisphere, int aNumberOfDigits)
    Returns the MGRS 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

    • TLcdUpsMgrsUtil

      public TLcdUpsMgrsUtil()
      Creates a new TLcdUpsMgrsUtil that uses the WGS_84 ellipsoid.
    • TLcdUpsMgrsUtil

      public TLcdUpsMgrsUtil(ILcdEllipsoid aEllipsoid)
      Creates a new TLcdUpsMgrsUtil that uses the given ellipsoid.
      Parameters:
      aEllipsoid - a given ellipsoid.
  • Method Details

    • getUPSCoordinateSeparator

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

      public void setUPSCoordinateSeparator(char aUPSCoordinateSeparator)
      Set the character to separate the zone 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.
      Parameters:
      aUPSCoordinateSeparator - the character to separate the zone and the coordinates and between the coordinates.
      See Also:
    • getZoneSeparator

      public char getZoneSeparator()
      Returns the character to separate the UPS grid zone and the 100km squares.
      Returns:
      the character to separate the UPS grid zone and the 100km squares.
      See Also:
    • setZoneSeparator

      public void setZoneSeparator(char aZoneSeparator)

      Sets the character to use as separator between the UPS grid zone and the 100km squares. Set the value to 0 (not the character '0') to have no separator between the UPS grid zone and the 100km squares.

      The default is 0.

      Parameters:
      aZoneSeparator - the character to separate the UPS grid zone and the 100km squares.
      See Also:
    • lonLat2UpsMgrs

      public String lonLat2UpsMgrs(ILcdPoint aLonLatPoint, int aNumberOfDigits) throws TLcdOutOfBoundsException
      Converts a lon-lat point (WGS84) into Military Grid System coordinates for a UPS projection. The MGRS coordinate for a position consists of a group of letters and numbers which include the following elements:

      1. The Grid Zone Designation.

      2. The 100,000-meter square letter identification.

      3. The grid coordinates (also referred to as rectangular coordinates); the numerical portion of the reference expressed to a desired refinement.

      A reference is written as an entity without spaces, parentheses, dashes, or decimal points.

      Parameters:
      aLonLatPoint - ILcdPoint to be converted. The point has to be specified within WGS84!
      aNumberOfDigits - defines the precision as the number of digits in the rectangular coordinates; must be a value between 0 and 5 inclusive:

      0: 4QFJ (Locating a point within a 100,000-meter square)

      1: 4QFJ16 (Locating a point within a 10,000-meter square)

      2: 4QFJ1267 (Locating a point within a 1,000-meter square)

      3: 4QFJ123678 (Locating a point within a 100-meter square)

      4: 4QFJ12346789 (Locating a point within a 10-meter square)

      5: 4QFJ1234567890 (Locating a point within a 1-meter square).

      Returns:
      a String representing the coordinates in UPS-MGRS coordinates.
      Throws:
      TLcdOutOfBoundsException - if the coordinate is outside the bounds.
    • upsXY2UpsMgrs

      public String upsXY2UpsMgrs(double aEasting, double aNorthing, boolean aNorthernHemisphere, int aNumberOfDigits) throws TLcdOutOfBoundsException
      Returns the MGRS 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.
      aNorthernHemisphere - if true, the coordinate is specified within the northern UPS grid system, and within the southern UPS grid system otherwise.
      aNumberOfDigits - the number of digits to use with a 100000 meter block.
      Returns:
      the MGRS formatted notation for a given coordinate within the UPS grid system.
      Throws:
      TLcdOutOfBoundsException - if the coordinate is out of bounds.
    • upsMgrs2LonLat

      public void upsMgrs2LonLat(String aUpsMgrsCell, ILcd2DEditablePoint a2DPointSFCT) throws ParseException
      Finds the geodetic coordinates of the lower-left corner of a square cell expressed in the MGRS Universal polar Stereographic notation. Note that the corner itself may have a latitude outside the legal MGRS UPS range.
      Parameters:
      aUpsMgrsCell - the cell
      a2DPointSFCT - a lon/lat point that will be set to the coordinates of the lower-left corner of the cell
      Throws:
      ParseException - if aUpsMgrsCell is not a valid cell identifier
    • upsMgrs2UpsXY

      public void upsMgrs2UpsXY(String aUpsMgrsCell, ILcd2DEditablePoint a2DPointSFCT) throws ParseException
      Finds the grid coordinates of the lower-left corner of a square cell expressed in the MGRS Universal polar Stereographic notation. Note that the corner itself may have a latitude outside the legal MGRS UPS range.
      Parameters:
      aUpsMgrsCell - the cell
      a2DPointSFCT - a grid point that will be set to the coordinates of the lower-left corner of the cell
      Throws:
      ParseException - if aUpsMgrsCell is not a valid cell identifier