From 5ac745717c0098d01eb293ff1fe32fd7358c76ab Mon Sep 17 00:00:00 2001 From: David Shean Date: Mon, 8 Apr 2019 09:54:40 -0700 Subject: [PATCH] geolib: update dms2dd_str to remove consecutive delimiters --- pygeotools/lib/geolib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pygeotools/lib/geolib.py b/pygeotools/lib/geolib.py index 14f08c9..7a4195b 100755 --- a/pygeotools/lib/geolib.py +++ b/pygeotools/lib/geolib.py @@ -379,8 +379,11 @@ def dms2dd_str(dms_str, delim=' ', fmt=None): sign = -1 else: sign = 1 + #re.split('\s+', s) #(degree, minute, second, frac_seconds) = map(int, re.split('\D+', dms_str)) - (degree, minute, second) = dms_str.split(delim)[0:3] + #(degree, minute, second) = dms_str.split(delim)[0:3] + #Remove consequtive delimiters (empty string records) + (degree, minute, second) = [s for s in dms_str.split(delim) if s] #dd = sign * (int(degree) + float(minute) / 60 + float(second) / 3600 + float(frac_seconds) / 36000) dd = dms2dd(int(degree)*sign, int(minute), float(second)) return dd