Created
July 11, 2014 13:48
-
-
Save philippgeisler/9871032bd7529cd3c0ab to your computer and use it in GitHub Desktop.
Shell script grabbing bounding box coordinates for an array of cities
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/zsh | |
url='http://open.mapquestapi.com/nominatim/v1/search.php' | |
# url='http://nominatim.openstreetmap.org/search' | |
if [ -e locations ] | |
then | |
rm locations | |
fi | |
for c in Berlin Dortmund Frankfurt Hamburg München | |
do | |
wget -O "bbox-$c.json" "$url?city=$c&countrycodes=de&limit=1&format=json" | |
jq -c '.[].display_name,(.[].boundingbox|.[])' "bbox-$c.json" | tr '\n' ' ' | sed 's/"//g' | sed 's/,.*[a-z]\ /\ /' >> locations | |
echo >> locations | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment