GPX i.e. GPS Exchange Format (in XLM)
Bas den Brok - mapping course
Reading latitude, longtitude, elevation and time of GPX files in python
and printing values on screen and write them to a text file
Some basic knowledge of XML and python required
Two examples of different .gpx files
First example two waypoints
Second example three trackpoints in a track
Some important GPX tags
<trk> = track
<trkseg> = tracksegment
<trkpt> = trackpoint lat = "latitude WGS84 in decimal degrees" lon = "longitude WGS84 in decimal degrees"
<wpt> = waypoint
<ele> = elevation (in m)
<name> =
<time> = year-month-day hours:minutes:seconds Z (Z for UTC Coordinated Universal Time)
Here below is simple python code to read values from a GPX file and print these to screen
This is the GPX file: GPSwaypoints2021-03-4bb.gpx
And the python code: read_and_write_GPX_values_to_TXT_file.py
Download pgxpy from here: https://github.com/tkrajina/gpxpy
This is the .gpx file GPSwaypoints2021-03-4bb.gpx with the three waypoints 333, 302 and 303.
Here below is the output on screen
Per waypoint latitude, longitude, elevation and time
Here below the python code to read values from GPX file
GPSwaypoints2021-03-4bb.gpx and print these to screen and write them to text file
This the python file: read_and_write_GPX_values_to_TXT_file.py
This is the output on screen
Per waypoint latitude, longitude, elevation and time
The numbers 28, 27, 27 and 27 indicate the numbers of characters printed to the text file
And this is the txt file
Maybe continue here about writing GPX data to SVG-file for on SVG-map:
http://www.denbrok.ch/geology/exchange/gpx/gpx_to_svg.html