Created
October 25, 2018 10:32
-
-
Save aoles/4167a15b054f609b49cd6fb92179e37a to your computer and use it in GitHub Desktop.
Sample script for creating geographic extracts of OSM data
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 | |
URL=https://download.geofabrik.de/europe/germany/baden-wuerttemberg/karlsruhe-regbez-latest.osm.pbf | |
RELATION_ID=62691 | |
RELATION_NAME=mannheim | |
### | |
echo "Downloading $URL" | |
SOURCE=$(basename "$URL") | |
curl $URL -o $SOURCE | |
echo "Getting boundary" | |
BOUNDARY=$RELATION_NAME-boundary.osm | |
osmium getid -r $SOURCE r$RELATION_ID -o $BOUNDARY | |
echo "Extracting region" | |
OUTPUT=$RELATION_NAME.osm.gz | |
osmium extract -p $BOUNDARY $SOURCE -o $OUTPUT --overwrite | |
rm $BOUNDARY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment