Skip to content

Instantly share code, notes, and snippets.

@luanlmd
Last active August 29, 2015 14:02
Show Gist options
  • Save luanlmd/d3ec89b8cdb221cfb598 to your computer and use it in GitHub Desktop.
Save luanlmd/d3ec89b8cdb221cfb598 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# convert a set of waypoints of a gpx file into utm ground control points txt
# setup: pip install gpxpy utm
# usage: ./gpxexport.py path/to/file.gpx
import sys
import gpxpy
import gpxpy.gpx
import utm
gpx_file = open(sys.argv[1], 'r')
gpx = gpxpy.parse(gpx_file)
for wpt in gpx.waypoints:
coord = utm.from_latlon(wpt.latitude, wpt.longitude)
print(wpt.name, coord[0], coord[1], wpt.elevation, '0 0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment