Created
August 9, 2016 10:58
-
-
Save daniel-j-h/6a1dbe506b9bb443bd21c2d7d466302e to your computer and use it in GitHub Desktop.
1/ go to geojson.io draw bounding box, save as bbox.geojson 2/ cut.sh big.pbf bbox.geojson small.pbf
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
#!/usr/bin/env bash | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
if [ $# -ne 3 ]; then | |
echo "Usage: cut.sh planet.pbf bbox.geojson outfile" | |
exit 1 | |
fi | |
readonly bbox=$(jq --raw-output '.features[0].geometry.coordinates[0] | "top=" + ( .[1][1] | tostring) + " left=" + ( .[0][0] | tostring ) + " bottom=" + ( .[0][1] | tostring ) + " right=" + ( .[2][0] | tostring )' "${2}") | |
osmosis \ | |
--read-pbf "${1}" \ | |
--bounding-box ${bbox} \ | |
--write-pbf "${3}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment