Skip to content

Instantly share code, notes, and snippets.

@ckhung
Last active Aug 29, 2015
Embed
What would you like to do?
convert GraphHopper exported gpx to geojson suitable for importing into umap
#!/bin/bash
# usage: gh2umap.sh directions.gpx > directions.geojson
# see http://newtoypia.blogspot.tw/2015/07/fs-biking.html
TMPDIR=/tmp/gh2umap-$$
mkdir $TMPDIR
ogr2ogr -f geojson $TMPDIR/tr.geojson $1 tracks
jq '.features' $TMPDIR/tr.geojson > $TMPDIR/tracks.geojson
ogr2ogr -f geojson $TMPDIR/rp.geojson $1 route_points
opencc < $TMPDIR/rp.geojson | jq '.features | map(.properties+={_storage_options: {"iconClass": "Ball"}} | .properties.name=.properties.desc )' > $TMPDIR/route_points.geojson
jq -s '.[0] + .[1]' $TMPDIR/tracks.geojson $TMPDIR/route_points.geojson
rm -rf $TMPDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment