From aea67c076962557a30b3db3f21d69ad93691d006 Mon Sep 17 00:00:00 2001 From: Al Date: Tue, 4 Oct 2016 18:33:52 -0400 Subject: [PATCH] [osm] adding admin1 exceptions to the country polygons --- scripts/geodata/osm/fetch_osm_address_data.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/geodata/osm/fetch_osm_address_data.sh b/scripts/geodata/osm/fetch_osm_address_data.sh index 65320816..fc3ba42f 100755 --- a/scripts/geodata/osm/fetch_osm_address_data.sh +++ b/scripts/geodata/osm/fetch_osm_address_data.sh @@ -19,6 +19,10 @@ fi set -e +THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +RESOURCES_DIR=$THIS_DIR/../../../resources +ADMIN1_FILE=$RESOURCES_DIR/language/regional/adm1.tsv + # Check for osmfilter and osmconvert if ! type -P osmfilter osmconvert > /dev/null; then cat << EOF @@ -118,6 +122,7 @@ PLANET_BORDERS="planet-borders.osm" PLANET_ADMIN_BORDERS_OSM="planet-admin-borders.osm" VALID_COUNTRY_KEYS="ISO3166-1:alpha2=" +ADMIN1_LANGUAGE_EXCEPTION_IDS=$(grep "osm" $ADMIN1_FILE | sed 's/^.*relation:\([0-9][0-9]*\).*$/@id=\1/' | xargs echo | sed 's/\s/ or /g') VALID_ADMIN_BORDER_KEYS="boundary=administrative or boundary=town or boundary=city_limit or boundary=civil_parish or boundary=civil or boundary=ceremonial or place=island or place=city or place=town or place=village or place=hamlet or place=municipality or place=settlement" @@ -137,7 +142,7 @@ osmconvert $PLANET_BORDERS_O5M --max-objects=1000000000 --all-to-nodes -o=$PLANE rm $PLANET_BORDERS_O5M osmfilter $PLANET_BORDERS_LATLONS --keep="$VALID_ADMIN_BORDER_KEYS or $VALID_LOCALITY_KEYS" -o=$PLANET_BORDERS rm $PLANET_BORDERS_LATLONS -osmfilter $PLANET_O5M --keep="$VALID_COUNTRY_KEYS" --drop-author --drop-version -o=$PLANET_COUNTRIES +osmfilter $PLANET_O5M --keep="$VALID_COUNTRY_KEYS or $ADMIN1_LANGUAGE_EXCEPTION_IDS" --drop-author --drop-version -o=$PLANET_COUNTRIES echo "Filtering for rail stations" VALID_RAIL_STATION_KEYS="railway=station"