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

incorrect error case handling for OSGridError #1

Open
Chris-Papaioannou opened this issue Jan 9, 2023 · 1 comment
Open

incorrect error case handling for OSGridError #1

Chris-Papaioannou opened this issue Jan 9, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Chris-Papaioannou
Copy link

The following code incorrectly results in an error flag:

from PyBNG import PyBNG
PyBNG(easting = 328993, northing = 97946).get_latlon()

Error code:

File "{USER}\AppData\Roaming\Python\Python39\site-packages\OSGridConverter\grid.py", line 71, in init
factor=pow(10,5)
OSGridConverter.base.OSGridError: OSGridConverter error: Invalid grid reference

It seems any BNG grid ref with 6 digits in one coordinate and 5 digits in the other is rejected.

@ThunderStruct
Copy link
Owner

This isn't a bug, BNG coordinates should have an even-numbered set of digits (from 2 to 10, depending on the quadrant size). Here's a reference that should help!

I'll leave this issue open for now nonetheless as a reminder to add better error-handling/clarify why a given grid reference is invalid. Good luck!

@ThunderStruct ThunderStruct added the enhancement New feature or request label Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants