proj4js / mgrs

Utility for converting between WGS84 lat/lng and MGRS coordinates
MIT License
105 stars 45 forks source link

MGRS inconsistent behavior #11

Closed ahocevar closed 5 years ago

ahocevar commented 9 years ago

Copied from proj4js/proj4js#151

If I pass in latitude (89.95337) longitude (-64.58372) and call:

           point = proj4.Point(latLong.lon, latLong.lat);
           retStr = point.toMGRS(5);

retStr has a value of 20ZME9985692761.

If I then call:

point = proj4.mgrs.toPoint('20ZME9985692761');

an exception is thrown: MGRSPoint zone letter Z not handled: 20ZME9985692761

Seems like if a mgrs string can be obtained from a latitude longitude, that the mgrs string should result in roughly the same latitude, longitude.

ahocevar commented 9 years ago

The MGRS utility currently only implements the UTM grid, so coordinates south of 80°S and north of 84°N will not work. See http://earth-info.nga.mil/GandG/publications/tm8358.1/tr83581b.html.

For this to work, someone would have to implement support for the Universal Polar Stereographic (UPS) grid.

DanielJDufour commented 5 years ago

I added data validation with https://github.com/proj4js/mgrs/pull/36, which should at least consistently throw an error if polar locations are passed in as a [lon, lat]

And created a new issue to track adding support for UPS: https://github.com/proj4js/mgrs/issues/33

I'm closing this issue as it was more of an issue with data validation than UPS support. Feel free to reopen or let me know if there are any questions :-)