Skip to content

Instantly share code, notes, and snippets.

@tsemerad
Created February 28, 2013 01:15
Show Gist options
  • Save tsemerad/5053378 to your computer and use it in GitHub Desktop.
Save tsemerad/5053378 to your computer and use it in GitHub Desktop.
Python function for converting degrees, minutes, seconds (DMS) coordinates to decimal degrees (DD).
def dms_to_dd(d, m, s):
dd = d + float(m)/60 + float(s)/3600
return dd
@lsxinh
Copy link

lsxinh commented Feb 25, 2021

thanks, just found it
def dms_to_dd(d, m, s):
if d[0]=='-':
dd = float(d) - float(m)/60 - float(s)/3600
else:
dd = float(d) + float(m)/60 + float(s)/3600
return dd

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