toUsngOrNull

fun toUsngOrNull(point: Point, precision: Int, addSpaces: Boolean): String?

Returns a formatted coordinate in United States National Grid (USNG) notation representing the given point's location. The precision value controls the number of digits used to represent each numerical easting and northing value within the USNG string. For example:

0false13TFJ100km
1false13TFJ2510km
2false13TFJ23591km
3false13TFJ237595100m
4false13TFJ2374595110m
5false13TFJ23743595121m
0true13T FJ100km
1true13T FJ 2 510km
2true13T FJ 23 591km
3true13T FJ 237 595100m
4true13T FJ 2374 595110m
5true13T FJ 23743 595121m

If the point's SpatialReference is NAD 27, then a suffix is added to the end of the formatted string. For example:

4false13TFJ23795929 (NAD 27)10m
2true13T FJ 23 59 (NAD 27)1km

When the point's spatial reference is based on NAD 27. The 'precision' should be in the interval 0, 8. The point must have a spatial reference. Returns null on error.

Return

A USNG notation string representing the position of the given point.

Since

200.1.0

Parameters

point

The coordinate to be represented in MGRS notation.

precision

The precision with which to represent the coordinate.

addSpaces

If false, the generated string contains no spaces. If true, a space separates the grid zone designator, the 100km square identifier, and the numerical easting and northing values.