Skip to content

Instantly share code, notes, and snippets.

@ajashton
Created September 28, 2012 22:09
Show Gist options
  • Save ajashton/3802321 to your computer and use it in GitHub Desktop.
Save ajashton/3802321 to your computer and use it in GitHub Desktop.
#!/bin/bash
# like [1] but DRYer
# [1]: https://github.com/migurski/HighRoad/blob/master/Makefile
declare -A latlon
latlon=(
[sfo]='37.807613 -122.279891'
[nyc]='40.756749 -73.998284'
[lon]='51.507553 -0.008271'
[mos]='55.882322 37.724175'
)
make_stylexml() {
cascadenik-compile.py style.mml style.xml
}
make_indexhtml() {
for city in ${!latlon[@]}; do
for z in {10..18}; do
python mapnik-render.py \
-f ../fonts -s style.xml -l ${latlon[$city]} \
-z $z -d 1024 512 -o renders/$city-$z.png
done
done
}
make_clean() {
rm -f style.xml
for city in ${!latlon[@]}; do
rm -f $city-*.png
done
}
case "$1" in
all) make_stylexml && make_indexhtml ;;
style.xml) make_stylexml ;;
index.html) make_indexhtml ;;
clean) make_clean ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment