Created
July 27, 2017 01:36
-
-
Save maxerickson/32ca41e72458b12a5734f97f75800448 to your computer and use it in GitHub Desktop.
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 -x | |
# transform USFS tag scheme to osm tags | |
INFILE=$1 | |
OUTFILE=$2 | |
INLAYER=$(basename $INFILE) | |
INLAYER=${INLAYER%.*} | |
OUTLAYER=$(basename $OUTFILE) | |
OUTLAYER=${OUTLAYER%.*} | |
# select interesting columns, create osm fields | |
ogr2ogr -overwrite -sql "select 'FS ' + ID as ref, NAME as name, SYMBOL_COD as fscode, '' as highway, '' as surface from $INLAYER" -f "ESRI Shapefile" $OUTFILE $INFILE | |
#tracks | |
ogrinfo $OUTFILE -dialect SQLite -sql "update $OUTLAYER set highway='track' where fscode = '106'" | |
# dirt, gravel, paved roads | |
ogrinfo $OUTFILE -dialect SQLite -sql "update $OUTLAYER set highway='unclassified', surface='dirt' where fscode = '515'" | |
ogrinfo $OUTFILE -dialect SQLite -sql "update $OUTLAYER set highway='unclassified', surface='paved' where fscode = '517'" | |
ogrinfo $OUTFILE -dialect SQLite -sql "update $OUTLAYER set highway='unclassified', surface='gravel' where fscode = '518'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment