Skip to content

Instantly share code, notes, and snippets.

@dmehrotra
Created January 13, 2021 18:49
Show Gist options
  • Save dmehrotra/b23db1cc1196e89ed99d25921c287697 to your computer and use it in GitHub Desktop.
Save dmehrotra/b23db1cc1196e89ed99d25921c287697 to your computer and use it in GitHub Desktop.
dms_to_dd.py
def dms_to_dd(data):
dd = float(data[0].strip()) + float(data[1].strip())/60 + float(data[2].strip())/(60*60);
if data[3].strip() == 'W' or data[3].strip() == 'S':
dd *= -1
return dd;
lat=re.split('[deg\'"]+',df['GPSLatitude'].values[0])
lon=re.split('[deg\'"]+',df['GPSLongitude'].values[0])
lat=dms_to_dd(lat)
lon=dms_to_dd(lon)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment