-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Support 100km precision and using centroid for latitude band letter resolution. #49
Conversation
…for resolving Latitude Band Letter based on centroid of the resultant square
@calvinmetcalf and @ahocevar , open to your thoughts :-) |
so what is the tl;dr of the issue, that certain software calculates from the origin but others from the centroid ? |
@calvinmetcalf, yes. That's correct. |
You introduce code and complexity for only one (very) special / peculiar use case. Not advisable for a general purpose library ... |
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. :) |
export function forward(ll, accuracy) { | ||
accuracy = accuracy || 5; // default accuracy 1m | ||
export function forward(ll, accuracy, useCentroid) { | ||
accuracy = typeof accuracy === 'number' ? accuracy : 5; // default accuracy 1m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably need a check for a boolean being passed here, in which case that value will be swiched to the useCentroid and accuracy set to 5
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 |
Changes:
Open to comments, suggestions and input :-)