Commit fd488e69 authored by enfo's avatar enfo

Adding latlonheight to rtk measurements

parent 88e76fad
......@@ -3,6 +3,7 @@
import sys
import os
import re
import numpy as np
from scipy.io import savemat
dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(dir_path, '..'))
......@@ -91,9 +92,30 @@ if __name__ == '__main__':
data['e_baseline'] = east
data['n_baseline'] = north
data['u_baseline'] = up
names += ['e_baseline', 'n_baseline', 'u_baseline']
except ImportError:
print('Install pymap3d to automatically add enu solution')
elif 'e_baseline' in names:
try:
from pymap3d import enu2geodetic
print('Adding latlon')
lat, lon, height = geodetic2enu(data['e_baseline'], data['n_baseline'], data['u_baseline'], *ref_pos)
data['latitude'] = lat
data['longitude'] = lon
data['height'] = height
names += ['latitude', 'longitude', 'height']
except ImportError:
print('Install pymap3d to automatically add enu solution')
print('Saving .mat')
savemat(outfile, {'rtklib': data})
print('Saving .npy')
values = np.array([data[name] for name in names])
struct_packs = np.array(values,
dtype={'names': names, 'formats': ['d']*len(names)})
np.savez_compressed(outfile[:-4], rtk=struct_packs)
print('Done.')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment