Package com.luciad.view.map
Class TLcdUTMUtil
java.lang.Object
com.luciad.view.map.TLcdUTMUtil
A utility class that can be used to format and parse lon lat points to/from a UTM String.
An example of a UTM String is "17T 630084 4833438"
. This String has the following
component :
- The UTM zone number. In the example String this is
"17"
. - A latitude letter. Because each easting, northing and zone combination describes two possible
positions, extra information needs to be supplied to make a distinction between them. Normally,
a letter describing the hemisphere (
'N'
or'S'
)is sufficient, but often the latitude band letter is provided instead. This class offers both possibilities (setUseLatitudeBandDesignator(boolean)
). In the example String, the latitude band letter"T"
is used. - The easting, in meters.
- The northing, in meters.
Note : The UTM Strings formatted and parsed by this class are no UTM Mgrs
Strings. To format or parse UTM Mgrs Strings, see TLcdUtmMgrsUtil
.
- Since:
- 8.4
-
Constructor Summary
ConstructorDescriptionCreates a newTLcdUTMUtil
instance that uses the WGS_84 ellipsoid for its calculations.TLcdUTMUtil
(ILcdEllipsoid aEllipsoid) Creates a newTLcdUTMUtil
instance that uses the given ellipsoid for its calculations. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of digits used to format a UTM String.char
Returns the character to separate the zone/grid letters and the coordinates.boolean
Returns if the latitude band designator is used to make sure each grid position is defined uniquely.lonLat2Utm
(ILcdPoint aLonLatPoint) This method converts the given lon lat point to a UTM String.void
setNumberOfDigits
(int aNumberOfDigits) Sets the number of digits used to format a UTM String.void
setUseLatitudeBandDesignator
(boolean aUseLatitudeBandDesignator) Set totrue
to use a latitude band designator to make sure that each grid position is defined uniquely.void
setUTMCoordinateSeparator
(char aUTMCoordinateSeparator) Set the character to separate the zone/grid letters and the coordinates and between the coordinates.void
utm2LonLat
(String aUtmString, ILcd2DEditablePoint a2DPointSFCT) Finds the geodetic coordinate associated with the given UTM formatted string.utmXY2Utm
(double aEasting, double aNorthing, int aZone, boolean aNorthernHemisphere) Converts an utm point into UTM format coordinates.
-
Constructor Details
-
TLcdUTMUtil
public TLcdUTMUtil()Creates a newTLcdUTMUtil
instance that uses the WGS_84 ellipsoid for its calculations. -
TLcdUTMUtil
Creates a newTLcdUTMUtil
instance that uses the given ellipsoid for its calculations.- Parameters:
aEllipsoid
- a given ellipsoid.
-
-
Method Details
-
isUseLatitudeBandDesignator
public boolean isUseLatitudeBandDesignator()Returns if the latitude band designator is used to make sure each grid position is defined uniquely.- Returns:
- if the latitude band designator is used to make sure each grid position is defined uniquely.
-
setUseLatitudeBandDesignator
public void setUseLatitudeBandDesignator(boolean aUseLatitudeBandDesignator) Set totrue
to use a latitude band designator to make sure that each grid position is defined uniquely. Set tofalse
to use a hemisphere designator ('S'
or'N'
).This value is set to
true
by default.- Parameters:
aUseLatitudeBandDesignator
-true
to use a latitude band designator,false
to use a hemisphere designator.
-
getUTMCoordinateSeparator
public char getUTMCoordinateSeparator()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:
-
setUTMCoordinateSeparator
public void setUTMCoordinateSeparator(char aUTMCoordinateSeparator) 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:
aUTMCoordinateSeparator
- 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 UTM String.- Returns:
- the number of digits used to format a UTM String.
- See Also:
-
setNumberOfDigits
public void setNumberOfDigits(int aNumberOfDigits) Sets the number of digits used to format a UTM 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
"17T 630084 4833438"
- When calling this method with a number of digits
7
, the same point will be formatted as"17T 0630084 4833438"
- When calling this method with a number of digits
4
, the same point will be formatted as"17T 0630 4833"
- Parameters:
aNumberOfDigits
- the number of digits used to format a String.
- When not calling this method, a point will be formatted as
-
lonLat2Utm
This method converts the given lon lat point to a UTM String.- Parameters:
aLonLatPoint
- a lon lat point.- Returns:
- an UTM String.
- Throws:
TLcdOutOfBoundsException
- when the given point is outside the UTM bounds.
-
utm2LonLat
Finds the geodetic coordinate associated with the given UTM formatted string.- Parameters:
aUtmString
- a UTM formatted string.a2DPointSFCT
- a geodetic point that will be set to the coordinates of the given String- Throws:
ParseException
- if aUtmString is not a valid UTM String.
-
utmXY2Utm
public String utmXY2Utm(double aEasting, double aNorthing, int aZone, boolean aNorthernHemisphere) throws TLcdOutOfBoundsException Converts an utm point into UTM format coordinates. SeelonLat2Utm
for more information.- Parameters:
aEasting
- the eastingaNorthing
- the northingaZone
- the utm zoneaNorthernHemisphere
-true
if the given point lies in the northern hemisphere.- Returns:
- a
String
representing the coordinates in UTM format coordinates. - Throws:
TLcdOutOfBoundsException
- if the coordinate is outside the valid area of the UTM projection.- See Also:
-