Skip to content

Instantly share code, notes, and snippets.

@zdila
Created December 28, 2015 15:36
Show Gist options
  • Save zdila/4d6c4b1abd9c7a42fc8b to your computer and use it in GitHub Desktop.
Save zdila/4d6c4b1abd9c7a42fc8b to your computer and use it in GitHub Desktop.
Map of GPS traces
# download list
curl -u '*Martin*:****' http://api.openstreetmap.org/api/0.6/user/gpx_files > list.xml
# download the traces not containing " by " in the description
for id in `xmlstarlet sel -t -m "//gpx_file/description[not(contains(., ' by '))]/.." -v @id -nl list.xml`; do echo $id; curl -u '*Martin*:****' http://api.openstreetmap.org/api/0.6/gpx/$id/data > $id.gpx; done
# merge traces
gpsbabel -i gpx $(for GPX in *.gpx; do echo -n " -f $GPX "; done) -o gpx -F merged.gpx
# simplify merged trace
gpsbabel -i gpx -f merged.gpx -x nuketypes,waypoints,routes -x duplicate,location -x discard,hdop=4 -x simplify,crosstrack,error=0.005k -o gpx -F merged_simple.gpx
# convert to shapefile for MapBox Studio
gpx2shp -s -t -b -L -S -T merged_simple.gpx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment