fromMgrsOrNull

fun fromMgrsOrNull(coordinates: String, spatialReference: SpatialReference?, mgrsConversionMode: MgrsConversionMode): Point?

Parses a coordinate in Military Grid Reference System (MGRS) notation, and returns a Point representing that location. The spatial reference provided must have an ellipsoid and datum matching those used by the source of the MGRS string. If no spatial reference is provided, it is assumed the MGRS string is referenced to WGS 84. For an explanation of the different modes for interpreting an MGRS notation string, please see MgrsConversionMode. Note that the choice between zone 01 and 60 has no impact when reading from an MGRS notation string. The MGRS string can contain leading and trailing whitespace and can have whitespace between the grid zone designator, the 100km square identifier, and the numerical eastings and northings.

MGRS notation examples
30UVG898998
30UVG 89885 99877
Returns null on error, including when the given string is not valid MGRS notation.

Return

A point with the location from the MGRS string in the spatial reference provided.

Since

200.1.0

Parameters

coordinates

The MGRS notation string for the coordinate.

spatialReference

A spatial reference that defines the datum and ellipsoid referenced by the MGRS coordinate.

mgrsConversionMode

The mode used by the given MGRS coordinates.

See also