toMgrsOrNull

fun toMgrsOrNull(point: Point, mgrsConversionMode: MgrsConversionMode, precision: Int, addSpaces: Boolean): String?

Returns a formatted coordinate in Military Grid Reference System (MGRS) notation representing the given point's location. 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 an impact only when generating the MGRS notation string for a point with longitude of exactly 180deg. The precision value controls the number of digits used to represent each numerical easting and northing value within the MGRS string. For example: precision | add_spaces | Example output | Approx precision ---------- | ---------- | ------------------ | ---------------- 0 | false | 30UVG | 100km 1 | false | 30UVG89 | 10km 2 | false | 30UVG8999 | 1km 3 | false | 30UVG898998 | 100m 4 | false | 30UVG89889988 | 10m 5 | false | 30UVG8988499881 | 1m 0 | true | 30U VG | 100km 1 | true | 30U VG 8 9 | 10km 2 | true | 30U VG 89 99 | 1km 3 | true | 30U VG 898 998 | 100m 4 | true | 30U VG 8988 9988 | 10m 5 | true | 30U VG 89884 99881 | 1m

The 'precision' should be in the interval 0, 8. The point must have a spatial reference. Returns null on error.

Return

An MGRS notation string representing the position of the given point.

Since

200.1.0