Created
July 31, 2013 18:54
-
-
Save bmander/6124976 to your computer and use it in GitHub Desktop.
Show GPS track in 3d
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 csv | |
import dateutil.parser | |
import calendar | |
#track 100 has a lot of nice pauses | |
#TRACK = 2000 #defines a box! | |
TRACK = 100 #defines a box! | |
rd = csv.reader( open("points.csv") ) | |
pts = [] | |
for trackid, tt, lat, lon in rd: | |
trackid = int(trackid) | |
if trackid<TRACK: | |
continue | |
if trackid>TRACK: | |
break | |
dt = dateutil.parser.parse(tt) | |
tt = calendar.timegm( dt.timetuple() ) | |
pts.append( (tt, float(lat), float(lon)) ) | |
zs = [pt[0] for pt in pts] | |
xs = [pt[2] for pt in pts] | |
ys = [pt[1] for pt in pts] | |
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
fig = plt.figure() | |
ax = fig.gca(projection='3d') | |
ax.plot(xs, ys, zs) | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment