-
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
inverse does not return bbox for 100km grid zone #29
Comments
This issue is the reason that I cannot use this project. Well that and I also cannot get a top level grid zone only by the first two letters. |
Hi, @gregsadetsky and @monkeytroy . Thanks for flagging that this is still a problem. I'll work on a solution and hopefully have it done within a week. Thanks! |
Any ETA on when this will be fixed? |
Hi, @chcolemanjr . I'm sorry for the delay. I'll try to have a fix by the end of next week (if not sooner). I'll post here and tag you when that is complete. |
@DanielJDufour Thanks for response and effort. I appreciate it. While you're looking at the inverse() function could you do a bounds check on the returned lat and longs? I noticed quite a few longitudes coming back with values greater than 180 and less than -180. Thanks again! |
Will do. Could you share some of these values returning erroneous bounds, so I can add that to the tests? |
@DanielJDufour Sure. Here you go: input mgrs: 1CAA returned from inverse(): -188.50987762588105 -71.75574866634604 -188.50987762588105 -71.75574866634604input mgrs: 56CAA returned from inverse(): 193.28146856805336 -72.8415504450606 193.28146856805336 -72.8415504450606input mgrs: 59CAA returned from inverse(): 202.73386440303392 -69.22888726751151 202.73386440303392 -69.22888726751151input mgrs: 60CAA returned from inverse(): 192.09223094379075 -76.11955480636547 192.09223094379075 -76.11955480636547input mgrs: 1DAA returned from inverse(): -188.50987762588105 -71.75574866634604 -188.50987762588105 -71.75574866634604input mgrs: 59DAA returned from inverse(): 202.73386440303392 -69.22888726751151 202.73386440303392 -69.22888726751151input mgrs: 60DAA returned from inverse(): 183.86206214277752 -58.45661355190297 183.86206214277752 -58.45661355190297input mgrs: 1EAA returned from inverse(): -183.1047976395489 -53.99291942689445 -183.1047976395489 -53.99291942689445input mgrs: 59EAA returned from inverse(): 188.87806686863846 -52.78874996684672 188.87806686863846 -52.78874996684672input mgrs: 60EAA returned from inverse(): 183.86206214277752 -58.45661355190297 183.86206214277752 -58.45661355190297input mgrs: 1FAA returned from inverse(): -183.1047976395489 -53.99291942689445 -183.1047976395489 -53.99291942689445input mgrs: 59FAA returned from inverse(): 188.87806686863846 -52.78874996684672 188.87806686863846 -52.78874996684672input mgrs: 60FAA returned from inverse(): 181.72363045788765 -40.55415972586964 181.72363045788765 -40.55415972586964input mgrs: 1GAA returned from inverse(): -181.4402761156065 -36.062361996833644 -181.4402761156065 -36.062361996833644input mgrs: 59GAA returned from inverse(): 184.1798329312292 -35.41600726991151 184.1798329312292 -35.41600726991151input mgrs: 60GAA returned from inverse(): 181.72363045788765 -40.55415972586964 181.72363045788765 -40.55415972586964input mgrs: 1HAA returned from inverse(): -181.4402761156065 -36.062361996833644 -181.4402761156065 -36.062361996833644input mgrs: 59HAA returned from inverse(): 184.1798329312292 -35.41600726991151 184.1798329312292 -35.41600726991151input mgrs: 60HAA returned from inverse(): 181.72363045788765 -40.55415972586964 181.72363045788765 -40.55415972586964input mgrs: 1JAA returned from inverse(): -180.77735832101328 -18.051740497996235 -180.77735832101328 -18.051740497996235input mgrs: 59JAA returned from inverse(): 182.26050842477588 -17.76056141770849 182.26050842477588 -17.76056141770849input mgrs: 60JAA returned from inverse(): 180.8885179770934 -22.559763789039238 180.8885179770934 -22.559763789039238input mgrs: 1KAA returned from inverse(): -180.77735832101328 -18.051740497996235 -180.77735832101328 -18.051740497996235input mgrs: 59KAA returned from inverse(): 182.26050842477588 -17.76056141770849 182.26050842477588 -17.76056141770849input mgrs: 60KAA returned from inverse(): 180.8885179770934 -22.559763789039238 180.8885179770934 -22.559763789039238input mgrs: 60LAA returned from inverse(): 180.603447968944 -4.5145965610339385 180.603447968944 -4.5145965610339385input mgrs: 60MAA returned from inverse(): 180.603447968944 -4.5145965610339385 180.603447968944 -4.5145965610339385input mgrs: 60NAA returned from inverse(): 180.69450574002454 13.541119562220727 180.69450574002454 13.541119562220727input mgrs: 1PAA returned from inverse(): -180.77735832101328 18.051740497996235 -180.77735832101328 18.051740497996235input mgrs: 59PAA returned from inverse(): 182.26050842477588 17.76056141770849 182.26050842477588 17.76056141770849input mgrs: 60PAA returned from inverse(): 180.69450574002454 13.541119562220727 180.69450574002454 13.541119562220727input mgrs: 1QAA returned from inverse(): -180.77735832101328 18.051740497996235 -180.77735832101328 18.051740497996235input mgrs: 59QAA returned from inverse(): 182.26050842477588 17.76056141770849 182.26050842477588 17.76056141770849input mgrs: 60QAA returned from inverse(): 181.21332730451644 31.565646188641153 181.21332730451644 31.565646188641153input mgrs: 1RAA returned from inverse(): -181.4402761156065 36.062361996833644 -181.4402761156065 36.062361996833644input mgrs: 59RAA returned from inverse(): 184.1798329312292 35.41600726991151 184.1798329312292 35.41600726991151input mgrs: 60RAA returned from inverse(): 181.21332730451644 31.565646188641153 181.21332730451644 31.565646188641153input mgrs: 1SAA returned from inverse(): -181.4402761156065 36.062361996833644 -181.4402761156065 36.062361996833644input mgrs: 59SAA returned from inverse(): 184.1798329312292 35.41600726991151 184.1798329312292 35.41600726991151input mgrs: 60SAA returned from inverse(): 181.21332730451644 31.565646188641153 181.21332730451644 31.565646188641153input mgrs: 1TAA returned from inverse(): -183.1047976395489 53.99291942689445 -183.1047976395489 53.99291942689445input mgrs: 59TAA returned from inverse(): 188.87806686863846 52.78874996684672 188.87806686863846 52.78874996684672input mgrs: 60TAA returned from inverse(): 182.52792431499915 49.520335070002616 182.52792431499915 49.520335070002616input mgrs: 1UAA returned from inverse(): -183.1047976395489 53.99291942689445 -183.1047976395489 53.99291942689445input mgrs: 59UAA returned from inverse(): 188.87806686863846 52.78874996684672 188.87806686863846 52.78874996684672input mgrs: 60UAA returned from inverse(): 182.52792431499915 49.520335070002616 182.52792431499915 49.520335070002616input mgrs: 1VAA returned from inverse(): -188.50987762588105 71.75574866634604 -188.50987762588105 71.75574866634604input mgrs: 59VAA returned from inverse(): 202.73386440303392 69.22888726751151 202.73386440303392 69.22888726751151input mgrs: 60VAA returned from inverse(): 186.33498896597143 67.34501697493593 186.33498896597143 67.34501697493593input mgrs: 1WAA returned from inverse(): -188.50987762588105 71.75574866634604 -188.50987762588105 71.75574866634604input mgrs: 59WAA returned from inverse(): 202.73386440303392 69.22888726751151 202.73386440303392 69.22888726751151input mgrs: 60WAA returned from inverse(): 186.33498896597143 67.34501697493593 186.33498896597143 67.34501697493593 |
Thank you @chcolemanjr . I'll look into it. As a fyi, NGA recently changed their MGRS calculations to use the centroid per "Fixed the truncation of MGRS coordinates by adding one-half the precision in MGRS to UTM conversions" (https://earth-info.nga.mil/GandG/update/index.php?action=home). This will require a re-write of some of the code, including the bounding box calculation. Unfortunately, I can't guarantee when this will be done. I'm definitely open to PRs if people can provide them. |
Hi I was planning on using this library but cant due to the issues above, is there ever going to be a fix for this or if not are there any resources youd recommend on how to fix it so I could make a PR? |
The fix is now available on a branch, please consult #68 Because so many people use this library, I need to write some tests that cover the 100k use cases (including toPoint) because I think this code may have indirect untested impact on the results of other function calls. |
Calling
mgrs.inverse
with a 100km grid zone identifier, such as16RGU
, returns the same latitude, longitude twice instead of a bounding box.I believe that this is by design -- see https://github.com/proj4js/mgrs/blob/master/mgrs.js#L78
Is there a particular reason why such grid identifiers are not converted into bounding boxes?
Thanks!
The text was updated successfully, but these errors were encountered: