Add a BaseCamp export rework script
This commit is contained in:
27
Python/process CSV with locations/functions/convertGPS.py
Normal file
27
Python/process CSV with locations/functions/convertGPS.py
Normal file
@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
|
||||
def dms2dd(degrees, minutes, seconds, direction):
|
||||
dd = float(degrees) + float(minutes)/60 + float(seconds)/(60*60);
|
||||
|
||||
return dd;
|
||||
|
||||
def dd2dms(deg):
|
||||
d = int(deg)
|
||||
md = abs(deg - d) * 60
|
||||
m = int(md)
|
||||
sd = (md - m) * 60
|
||||
return [d, m, sd]
|
||||
|
||||
def parse_dms(dms):
|
||||
parts = re.split('[^\d\w]+', dms)
|
||||
lat = dms2dd(parts[0], parts[1], parts[2], parts[3])
|
||||
|
||||
if 'W' in dms or 'S' in dms:
|
||||
lat = lat * -1
|
||||
|
||||
return (lat)
|
||||
|
||||
|
||||
#dd = parse_dms("5°38'38.5 W")
|
||||
#print(dd)
|
Reference in New Issue
Block a user