Class TLcdUtmMgrsUtil
- All Implemented Interfaces:
Serializable
TLcdUtmMgrsUtil
is a utility class for the UTM Military Grid
Reference, which is an alphanumeric version of a numerical UTM
(Universal Transverse Mercator) grid coordinate.- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a newTLcdUtmMgrsUtil
that uses the WGS_84 ellipsoid.TLcdUtmMgrsUtil
(ILcdEllipsoid aEllipsoid) Creates a newTLcdUtmMgrsUtil
that uses the given ellipsoid. -
Method Summary
Modifier and TypeMethodDescriptionchar
Returns the character to separate the 100 km square letters and the coordinates.char
Returns the character to separate the UTM grid zone and the 100km squares.lonLat2UtmMgrs
(ILcdPoint aLLP, int aNumberOfDigits) Converts a lon-lat point into Military GridSystem
coordinates for a UTM projection.void
setUTMCoordinateSeparator
(char aUTMCoordinateSeparator) Set the character to use as separator between the 100 km square letters and the grid coordinates and between both grid coordinates.void
setZoneSeparator
(char aZoneSeparator) Sets the character to use as separator between the UTM grid zone and the 100km squares.utmMgrs2LonLat
(String aString) Finds the geodetic coordinate of a point in the square cell expressed in MGRS UTM notation.void
utmMgrs2UtmXY
(String aString, ILcd2DEditablePoint a2DPointSFCT) Finds the UTM coordinate of a point in the square cell expressed in MGRS UTM notation.utmXY2UtmMgrs
(double aEasting, double aNorthing, int aZone, boolean aNorthernHemisphere, int aNumberOfDigits) Converts an utm point into Military GridSystem
coordinates for a UTM projection.
-
Constructor Details
-
TLcdUtmMgrsUtil
public TLcdUtmMgrsUtil()Creates a newTLcdUtmMgrsUtil
that uses the WGS_84 ellipsoid. -
TLcdUtmMgrsUtil
Creates a newTLcdUtmMgrsUtil
that uses the given ellipsoid.- Parameters:
aEllipsoid
- a given ellipsoid.
-
-
Method Details
-
utmMgrs2LonLat
Finds the geodetic coordinate of a point in the square cell expressed in MGRS UTM notation.- Parameters:
aString
- the square cell.- Returns:
- the geodetic coordinate of a point in the given square cell.
- Throws:
ParseException
- if the given String is not a valid cell identifier.
-
getUTMCoordinateSeparator
public char getUTMCoordinateSeparator()Returns the character to separate the 100 km square letters and the coordinates.- Returns:
- the character to separate the 100 km square letters and the coordinates.
- See Also:
-
setUTMCoordinateSeparator
public void setUTMCoordinateSeparator(char aUTMCoordinateSeparator) Set the character to use as separator between the 100 km square letters and the grid coordinates and between both grid coordinates. Set the value to
0
(not the character'0'
) to have no separator.The default is
0
.- Parameters:
aUTMCoordinateSeparator
- 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 UTM grid zone and the 100km squares.- Returns:
- the character to separate the UTM grid zone and the 100km squares.
- See Also:
-
setZoneSeparator
public void setZoneSeparator(char aZoneSeparator) Sets the character to use as separator between the UTM grid zone and the 100km squares. Set the value to
0
(not the character'0'
) to have no separator between the UTM grid zone and the 100km squares.The default is
0
.- Parameters:
aZoneSeparator
- the character to separate the UTM grid zone and the 100km squares.- See Also:
-
lonLat2UtmMgrs
Converts a lon-lat point into Military GridSystem
coordinates for a UTM 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:
aLLP
-ILcd2DEditablePoint
to be converted.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 UTM-MGRS coordinates. - Throws:
TLcdOutOfBoundsException
- if the coordinate is outside the valid area of the UTM projection.- See Also:
-
utmXY2UtmMgrs
public String utmXY2UtmMgrs(double aEasting, double aNorthing, int aZone, boolean aNorthernHemisphere, int aNumberOfDigits) throws TLcdOutOfBoundsException Converts an utm point into Military GridSystem
coordinates for a UTM projection. SeelonLat2UtmMgrs
for more information.- Parameters:
aEasting
- the eastingaNorthing
- the northingaZone
- the utm zoneaNorthernHemisphere
-true
if the given point lies in the northern hemisphere.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 UTM-MGRS coordinates. - Throws:
TLcdOutOfBoundsException
- if the coordinate is outside the valid area of the UTM projection.- See Also:
-
utmMgrs2UtmXY
Finds the UTM coordinate of a point in the square cell expressed in MGRS UTM notation.- Parameters:
aString
- the square cell.a2DPointSFCT
- the point in which to store the UTM coordinate.- Throws:
ParseException
- if the given String is not a valid cell identifier.
-