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.
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.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.