proj4js / mgrs

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

WIP: Support 100km precision and using centroid for latitude band letter resolution. #49

Closed DanielJDufour closed 5 years ago

DanielJDufour commented 5 years ago

Changes:

Open to comments, suggestions and input :-)

DanielJDufour commented 5 years ago

@calvinmetcalf and @ahocevar , open to your thoughts :-)

calvinmetcalf commented 5 years ago

so what is the tl;dr of the issue, that certain software calculates from the origin but others from the centroid ?

DanielJDufour commented 5 years ago

@calvinmetcalf, yes. That's correct.

Klaus-Tockloth commented 5 years ago

You introduce code and complexity for only one (very) special / peculiar use case. Not advisable for a general purpose library ...

tonyVeco commented 5 years ago

I don't know if it is possible, but as it is a special case, you could maybe name it as an independent library (S2-MGRS could it be?), so that the standard version would be not affected by any change/update. :)

DanielJDufour commented 5 years ago

Thanks for the comments everyone. I did some more research into how the latitude band letter is determined in the Sentinel 2 titling grid. It appears that the band letter is based on the first point in the polygon representing the MGRS 100km grid cell and not the centroid or center point of the cell. They just both happen to lead to the same conclusion quite often. My recommendation for people trying to determine a Sentinel 2 Tile based on a latitude/longitude is to create a separate library. Thank you for your patience while I investigated this matter. I'll submit a separate PR for adding the ability to get the 100km MGRS Grid Cell by passing in an accuracy of 0.

You can find my (messy) work doing the research here: https://github.com/DanielJDufour/s2a-tiling-grid-analysis