Inspired by cabspotting and Open Street Map, I wanted to merge all my GPS logs and create a map showing all the routes I've logged lately.
This is pretty easy using gpsbabel, but I needed to use a little Python to get the list of input log files. (I'm sure there's a way to do it in bash but that's beyond me for now.) My GPS stores files in nmea format, and the directory structure/purpose of my Python script should hopefully be apparent.
>>> import os >>> from path import path >>> logs = " ".join([" ".join(["-i nmea -f %s"%log for log in sorted((raw/"raw").files("GPS_*.log"))]) for raw in path("/home/tom/docs/gpslogs").dirs() if raw.namebase.isdigit()]) >>> logs '-i nmea -f /home/tom/docs/gpslogs/200810/raw/GPS_20080930_221152.log -i nmea -f /home/tom/docs/gpslogs/200810/raw/GPS_20081001_071234.log ...' >>> os.system("gpsbabel %s -o kml,points=0,labels=0,trackdata=0 -F /home/tom/docs/gpslogs/all200810.kml" % logs)
The result of that is a 36.5 MB kml file I could load into Google Earth:
There was one spurious point somewhere in the log file at 0° E, 0° N, and the log has a lot of jitter when I'm walking near home.
No comments:
Post a Comment