chrisveness / geodesy

Libraries of geodesy functions implemented in JavaScript
http://www.movable-type.co.uk/scripts/geodesy-library.html
MIT License
1.17k stars 203 forks source link

Is UTM correct? Only N is used, which would be the first latitude sector north of the equator #97

Closed klyvare closed 3 years ago

klyvare commented 3 years ago

Lat N 55, Long E 10 results in UTM : 32 N 563967 6095249 Expected result: 32 U 563967 6095249 Mgrs looks good: 32U NF 63967 95248

I may be wrong about UTM, or using your excellent js in a wrong way giving me a result I did not expect. https://cdn.jsdelivr.net/npm/geodesy@2.2.1/mgrs.js

     * @example
     *   const mgrsRef = Mgrs.parse('31U DQ 48251 11932');
     *   const utmCoord = mgrsRef.toUtm(); // 31 N 448251 5411932

The above snippet indicates it is intentional, but I believe it is wrong*.

Edit: After reading some more I realize the notation with hemisphere is valid. I no longer believe it is wrong, sorry for that. Keep up the good work.

Best Regards, Rikard

chrisveness commented 3 years ago

There is quite a lot of confusion between UTM and MGRS – unsurprisingly, as they are intimately connected.

As Wikipedia points out, “Latitude bands are not a part of UTM, but rather a part of the military grid reference system (MGRS). They are however sometimes used”.

MGRS is based on UTM, and they share the same 60 ‘zones’, each 6° of longitude wide.

However, UTM defines points (to a given level of accuracy), either north (N) or south (S) of the equator, whereas MGRS defines grid squares (of a given size), within 20 latitude ‘bands’. Confusingly, MGRS latitude bands ‘N’ and ‘S’ are unrelated to the UTM hemisphere indicators.

Unfortunately, quite a number of sources perpetuate the confusion: you're not alone!