Last active
August 29, 2015 14:25
-
-
Save ckhung/486ffca6f8c966c2daac to your computer and use it in GitHub Desktop.
convert GraphHopper exported gpx to geojson suitable for importing into umap
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
#!/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