Created
January 13, 2021 18:49
-
-
Save dmehrotra/b23db1cc1196e89ed99d25921c287697 to your computer and use it in GitHub Desktop.
dms_to_dd.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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