Skip to content

Commit

Permalink
geolib: update dms2dd_str to remove consecutive delimiters
Browse files Browse the repository at this point in the history
  • Loading branch information
dshean committed Apr 8, 2019
1 parent 63d3dfb commit 5ac7457
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pygeotools/lib/geolib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5ac7457

Please sign in to comment.