Skip to content

Instantly share code, notes, and snippets.

@farhanarrafi
Created July 5, 2019 15:07
Show Gist options
  • Save farhanarrafi/1e359ce564e155913a9f10407b4f5531 to your computer and use it in GitHub Desktop.
Save farhanarrafi/1e359ce564e155913a9f10407b4f5531 to your computer and use it in GitHub Desktop.
Script to download map tiles from Open Street Maps for offline rendering
#!/bin/sh
# Script to download map tiles from Open Street Maps
# Author: Farhan Ar Rafi
# number of tiles in x and y direction
# this will be 2^Z
N=7
# sleep time between downloads
SLEEP=3
# zoom level
Z=3
for X in $(seq 0 $N);
do
for Y in $(seq 0 $N);
do
URL=http://a.tile.osm.org/$Z/$X/$Y.png;
FILE=$X$Y.png;
LOGS=download.log;
echo wget $URL -O $FILE -o $LOGS;
wget $URL -O $FILE -a $LOGS
sleep $SLEEP;
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment