public class MGRSCoord extends Object
| Constructor and Description |
|---|
MGRSCoord(Angle latitude,
Angle longitude,
String MGRSString)
Create an arbitrary MGRS coordinate from a pair of latitude-longitude
Angle
and the corresponding MGRS coordinate string. |
| Modifier and Type | Method and Description |
|---|---|
static MGRSCoord |
fromLatLon(Angle latitude,
Angle longitude)
Create a WGS84 MGRS coordinate from a pair of latitude and longitude
Angle
with the maximum precision of five digits (one meter). |
static MGRSCoord |
fromLatLon(Angle latitude,
Angle longitude,
Globe globe)
Create a MGRS coordinate from a pair of latitude and longitude
Angle
with the maximum precision of five digits (one meter). |
static MGRSCoord |
fromLatLon(Angle latitude,
Angle longitude,
Globe globe,
int precision)
Create a MGRS coordinate from a pair of latitude and longitude
Angle
with the given precision or number of digits (1 to 5). |
static MGRSCoord |
fromLatLon(Angle latitude,
Angle longitude,
int precision)
Create a WGS84 MGRS coordinate from a pair of latitude and longitude
Angle
with the given precision or number of digits. |
static MGRSCoord |
fromString(String MGRSString,
Globe globe)
Create a MGRS coordinate from a standard MGRS coordinate text string.
|
Angle |
getLatitude() |
Angle |
getLongitude() |
String |
toString() |
public MGRSCoord(Angle latitude, Angle longitude, String MGRSString)
Angle
and the corresponding MGRS coordinate string.latitude - the latitude Angle.longitude - the longitude Angle.MGRSString - the corresponding MGRS coordinate string.IllegalArgumentException - if latitude or longitude is null,
or the MGRSString is null or empty.public static MGRSCoord fromLatLon(Angle latitude, Angle longitude)
Angle
with the maximum precision of five digits (one meter).latitude - the latitude Angle.longitude - the longitude Angle.MGRSCoord.IllegalArgumentException - if latitude or longitude is null,
or the conversion to MGRS coordinates fails.public static MGRSCoord fromLatLon(Angle latitude, Angle longitude, Globe globe)
Angle
with the maximum precision of five digits (one meter).latitude - the latitude Angle.longitude - the longitude Angle.globe - the Globe.MGRSCoord.IllegalArgumentException - if latitude or longitude is null,
the globe is null, or the conversion to MGRS coordinates fails.public static MGRSCoord fromLatLon(Angle latitude, Angle longitude, Globe globe, int precision)
Angle
with the given precision or number of digits (1 to 5).latitude - the latitude Angle.longitude - the longitude Angle.globe - the Globe - can be null (will use WGS84).precision - the number of digits used for easting and northing (1 to 5).MGRSCoord.IllegalArgumentException - if latitude or longitude is null,
or the conversion to MGRS coordinates fails.public static MGRSCoord fromLatLon(Angle latitude, Angle longitude, int precision)
Angle
with the given precision or number of digits.latitude - the latitude Angle.longitude - the longitude Angle.precision - the number of digits used for easting and northing (1 to 5).MGRSCoord.IllegalArgumentException - if latitude or longitude is null,
or the conversion to MGRS coordinates fails.public static MGRSCoord fromString(String MGRSString, Globe globe)
The string will be converted to uppercase and stripped of all spaces before being evaluated.
Valid examples:
32TLP5626635418
32 T LP 56266 35418
11S KU 528 111
MGRSString - the MGRS coordinate text string.globe - the Globe - can be null (will use WGS84).MGRSCoord.IllegalArgumentException - if the MGRSString is null or empty,
the globe is null, or the conversion to geodetic coordinates fails (invalid coordinate string).public Angle getLatitude()
public Angle getLongitude()