MGRS to Lat Long Precision Issue

Former Member
Former Member

Hi all! I'm trying to convert a 15 didgit MGRS to the respective GEO_DMS, GEO_DEG, GEO_DM coords.

There seems to be an issue with the precision of the conversion.

Take the MGRS: '31U CT 41024 19890'

GEO_DEG: result should be N 51.60757, E 0.703736 but its N 51.611383 E 0.703736
GEO_DMS: result should be N 51° 36' 27.27", E 0° 42' 14.94" E but its N 51° 36'40.98", E 0° 42'13.45"
GEO_DM:    result should be N 51° 36.454' E 0° 42.249' but its N 51°36.9830' E 0°42.2241'

        var locationString = "31U CT 41024 19890";
        var location = Position.parse(locationString, Position.GEO_MGRS);
        System.println(location.toGeoString(Position.GEO_DM));
        System.println(location.toGeoString(Position.GEO_DMS));
        System.println(location.toGeoString(Position.GEO_DEG));

Would anyone mind telling me if I'm doign something wrong or if this is the expected results. Its like the MGRS is being trimmed when the location object is created. I really need the precision for 15 MRGS strings.

N.B. this is a handy site to check the accuracy of conversions https://legallandconverter.com/p50.html

Many Thanks, Adam

  • Its like the MGRS is being trimmed when the location object is created. I really need the precision for 15 MRGS strings.

    I haven't looked into your issue and I don't yet know much about the various coordinate standards.. I'm just responding to the above statement...

    The precision of Position.Location the same regardless of how you construct it or what format is used to parse it. Internally it is storing the latitude/longitude as 32-bit semicircles. If my reading is correct, that gives one semicircle is 180.0 / 2147483647 degrees (‭8.381903175442434e-8)‬. I'm not sure of the precision afforded by a 15 digit MGRS coordinate, but it it is better than that of the semicircle, you can expect to see precision loss.

  • Former Member
    0 Former Member over 4 years ago in reply to Travis.ConnectIQ

    Thanks for your message Travis.

    The precision stored in that format should accomadate the precision I desire.

    Inerestingly it appears 15 MGRS has precision to 1m and whilst you should have precision to ~11mm.

    Taking the MGRS, 4Q FJ 12345 67890

    The conversion should be as followed.

    21.40980     -157.91608
    21° 24.588' N     157° 54.965' W
    21° 24' 35.27" N     157° 54' 57.89" W

    location.toGeoString returns

    21.411241 -157.915971
    21° 24.6744' N     157° 54.9583'
    21° 24' 40.47" N 157°54' 57.50 W

    So from what I understand difference in conversion is incorrect not due to precision but due to an issue with how the MGRS is being coverted to the internal type.