-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathinit.sh
executable file
·42 lines (35 loc) · 1.08 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# node-tileserver Copyright (C) 2014 Alexander Matheisen
# This program comes with ABSOLUTELY NO WARRANTY.
# This is free software, and you are welcome to redistribute it under certain conditions.
# See https://github.com/rurseekatze/node-tileserver for details.
# TODO store in config file
MINZOOM="0"
MAXZOOM="20"
MAXPRERENDER="8"
MAXCACHED="16"
MINEXPIRING="8"
TILESERVERPORT="9999"
echo "Started initial rendering at $(date)"
# calculate amount of tiles to render
LISTLENGTH=0
for (( Z=MINZOOM; Z<=MAXPRERENDER; Z++ ))
do
LISTLENGTH=$(( LISTLENGTH + 2 ** (2 * Z) ))
done
echo "Initial rendering of $((LISTLENGTH / 1000)) k tiles. This process can take some time."
for (( Z=MINZOOM; Z<=MAXPRERENDER; Z++ ))
do
LENGTH=$((2 ** Z))
TILECOUNT=$(( LENGTH ** 2 ))
echo "Rendering $TILECOUNT tiles at zoom level $Z..."
for (( X=0; X<LENGTH; X++ ))
do
for (( Y=0; Y<LENGTH; Y++ ))
do
echo "$Z/$X/$Y"
curl --retry 5 --retry-delay 5 --silent "http://localhost:$TILESERVERPORT/vector/$Z/$X/$Y.js/dirty" > /dev/null
done
done
done
echo "Finished initial rendering at $(date)"