Skip to content

Incorrect Point.from_string() parsing #237

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

Closed
GeoTime61 opened this issue May 19, 2024 · 0 comments
Closed

Incorrect Point.from_string() parsing #237

GeoTime61 opened this issue May 19, 2024 · 0 comments

Comments

@GeoTime61
Copy link
Contributor

When parsing coordinates from various geocache web pages, the Point class does not correctly parse coordinate strings when the latitude and longitude are separated by <space><comma><space>. For example, the Geocache Description for GC6V1Y8 contains the string "N 44° 25.845 , W 72° 02.485" which Point parses as "N 72° 0.000, E 2° 29.100". This simple program shows the error.

from pycaching.geo import Point

print(Point("N 44° 25.845, W 72° 02.485"))
print(Point("N 44° 25.845 , W 72° 02.485"))

It might be as simple as changing geo.py line 69 from:
m = re.match(r"\s*(-?\s*\d+)\D+(\d+[\.,]\d+)\D?\s*(-?\s*\d+)\D+(\d+[\.,]\d+)", coords)

to:
m = re.match(r"\s*(-?\s*\d+)\D+(\d+[\.,]\d+)\D+(-?\s*\d+)\D+(\d+[\.,]\d+)", coords)
(replace "\D?\s*" with "\D+"), but I don't know what all the supported input formats are to evaluate that change.

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

No branches or pull requests

2 participants