Skip to content
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

mgrs.inverse(uuidString) returns an array of NaN values #69

Open
matthias-ccri opened this issue Dec 9, 2021 · 2 comments
Open

mgrs.inverse(uuidString) returns an array of NaN values #69

matthias-ccri opened this issue Dec 9, 2021 · 2 comments

Comments

@matthias-ccri
Copy link

Calling mgrs.inverse('1fcd3c38-ef3d-462d-8fd4-6191bde89736') returns [NaN, NaN, NaN, NaN].

The input string is not a mgrs string so it's expected that mgrs would fail to parse it. But could the library fail in a more obvious way, such as returning undefined or throwing an error?

Our company got bitten by this, since we were using mgrs to detect whether a string was mgrs. We have a search field where the user can enter latlon coordinates, mgrs, and place names, and so our code tries to detect whether a string is mgrs. Unfortunately, we considered an array return value to be a successful parse. We now have code to check for the NaNs. Should this failure case be improved?

Thanks.

@DanielJDufour
Copy link
Collaborator

Hi, @matthias-ccri . That's a great suggestion! Would you like to work on a contribution and submit a Pull Request? If not, I can try to get to it, but I can't promise that would happen soon.

@DanielJDufour
Copy link
Collaborator

If you (or whoever) works on this, please also add a test case to https://github.com/proj4js/mgrs/blob/master/test/test.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants