<filename>gps/gpx_graphs.py<gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import gpxpy
import gpxpy.gpx

# Open and parse the gpx file
gpx_file = open('20211024.gpx', 'r')	# open the file

gpx = gpxpy.parse(gpx_file)		# parse the file and create gpx object

points = gpx.tracks[0].segments[0].points	# get points from the first segment from the first track

# Remove the bad points from the start of the file (depends on the gps track)
points = points[80:]

# Get relevant gpx values (columns)
ts = np.array([point.time for point in points], dtype=(np.datetime64))		# get time objects and format as datetime
lat, lon, ele, hdop, vdop = np.array([[point.latitude, point.longitude, point.elevation, point.position_dilution, point.vertical_dilution] for point in points]).T	# parse interesting values

# Make graphs
plt.figure()
plt.plot(ts, ele, label='elevation')
plt.plot(ts, vdop, label='VDOP')
plt.xlabel('Date')
plt.legend()
plt.show()
<filename>gps/gpx_graphs.py<gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import gpxpy
import gpxpy.gpx

# Open and parse the gpx file
gpx_file = open('20211024.gpx', 'r')	# open the file

gpx = gpxpy.parse(gpx_file)		# parse the file and create gpx object

points = gpx.tracks[0].segments[0].points	# get points from the first segment from the first track

# Remove the bad points from the start of the file (depends on the gps track)
points = points[80:]

# Get relevant gpx values (columns)
ts = np.array([point.time for point in points], dtype=(np.datetime64))		# get time objects and format as datetime
lat, lon, ele, hdop, vdop = np.array([[point.latitude, point.longitude, point.elevation, point.position_dilution, point.vertical_dilution] for point in points]).T	# parse interesting values

# Make graphs
plt.figure()
plt.plot(ts, ele, label='elevation')
plt.plot(ts, vdop, label='VDOP')
plt.xlabel('Date')
plt.legend()
plt.show()
# Open and parse the gpx file # open the file # parse the file and create gpx object # get points from the first segment from the first track # Remove the bad points from the start of the file (depends on the gps track) # Get relevant gpx values (columns) # get time objects and format as datetime # parse interesting values # Make graphs