Last active
August 29, 2015 14:14
-
-
Save seumasmorrison/d3f3afa96b350163909b to your computer and use it in GitHub Desktop.
Coordinate conversion from Degrees Minutes Decimal Second to Decimal Degrees on points exported from Leica Geo Office in csv format using LatLon and Pandas. Used for preparation for import to QGIS for creating contours from points with the Contours plugin.
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
import LatLon | |
import pandas as pd | |
import re | |
leica_points = pd.read_csv('D://project_3.csv',names=['id','type','timestamp','Latitude','Longtitude','Height','Quality']) | |
coords = [] | |
chars = '[\xb0\'"]' | |
for index, row in leica_points.iterrows(): | |
lat_dmds = re.sub(chars,'',row.Latitude) | |
long_dmds = re.sub(chars,'',row.Longtitude) | |
coord = LatLon.string2latlon(lat_dmds,long_dmds,'d% %m% %S% %H') | |
coords.append([coord.lat.decimal_degree, coord.lon.decimal_degree]) | |
coords_df = pd.DataFrame(coords, columns=['Latitude, Longtitude']) | |
leica_points.Latitude = coords_df.Latitude | |
leica_points.Longtitude = coords_df.Longtitude | |
leica_points.to_csv('leica_points.csv') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment