This repository has been archived by the owner on Feb 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
42 additions
and
193 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,10 @@ | ||
#!/bin/bash | ||
|
||
search () { | ||
zoom[$1]=$(($1+1)) | ||
x[$1]=$(($2*2)) | ||
y[$1]=$(($3*2)) | ||
z[$1]=$((2**${zoom[$1]})) | ||
for ((i[$1]=0; ${i[$1]}<2; i[$1]=${i[$1]}+1)); do | ||
for ((j[$1]=0; ${j[$1]}<2; j[$1]=${j[$1]}+1)); do | ||
os=$(echo "scale=10; ${z[$1]}/4096" | bc) | ||
tile=$(echo "scale=10; (${x[$1]}+${i[$1]}-$os)" | bc) | ||
tile=$(echo "scale=10; if ($tile < 0) $tile+${z[$1]} else $tile" | bc) | ||
minlon=$(echo "scale=10; (($tile/${z[$1]})*360)-180" | bc) | ||
tile=$(echo "scale=10; (${x[$1]}+${i[$1]}+1+$os)" | bc) | ||
tile=$(echo "scale=10; if ($tile >= ${z[$1]}) $tile-${z[$1]} else $tile" | bc) | ||
maxlon=$(echo "scale=10; (($tile/${z[$1]})*360)-180" | bc) | ||
tile=$(echo "scale=10; (${y[$1]}+${j[$1]}-$os)" | bc -l) | ||
tile=$(echo "scale=10; if ($tile < 0) 0 else $tile" | bc) | ||
yx=$(echo "scale=10; 4*a(1)*(1-((2*$tile)/${z[$1]}))" | bc -l) | ||
maxlat=$(echo "scale=10; ((a((e($yx)-(1/e($yx)))/2))*180)/(4*a(1))" | bc -l) | ||
tile=$(echo "scale=10; (${y[$1]}+${j[$1]}+1+$os)" | bc -l) | ||
tile=$(echo "scale=10; if ($tile >= ${z[$1]}) ${z[$1]}-1 else $tile" | bc) | ||
yx=$(echo "scale=10; 4*a(1)*(1-((2*$tile)/${z[$1]}))" | bc -l) | ||
minlat=$(echo "scale=10; ((a((e($yx)-(1/e($yx)))/2))*180)/(4*a(1))" | bc -l) | ||
if [ $minlat = 0 ]; then minlat=-85.0; fi | ||
osmosis -q --rx file=tmp/panel-z$1.osm --bb top=$maxlat left=$minlon bottom=$minlat right=$maxlon completeWays=yes --wx file=tmp/panel-z${zoom[$1]}.osm 2> /dev/null | ||
timestamp=$(../util/checkdate tmp/panel-z${zoom[$1]}.osm) | ||
bb="$minlat,$minlon,$maxlat,$maxlon" | ||
tx=$((${x[$1]}+${i[$1]})) | ||
ty=$((${y[$1]}+${j[$1]})) | ||
if [ $timestamp \> $previous ]; then | ||
if [ ${zoom[$1]} -lt 12 ]; then | ||
if [ ${zoom[$1]} -eq 9 ]; then | ||
bb9=$bb; tx9=$tx; ty9=$ty | ||
fi | ||
if [ ${zoom[$1]} -eq 10 ]; then | ||
bb10=$bb; tx10=$tx; ty10=$ty | ||
fi | ||
if [ ${zoom[$1]} -eq 11 ]; then | ||
bb11=$bb; tx11=$tx; ty11=$ty | ||
fi | ||
search ${zoom[$1]} $tx $ty | ||
else | ||
../searender/searender ../searender/symbols/symbols.defs 19 $bb >tmp/panel.svg <tmp/panel-z12.osm | ||
inkscape tmp/panel.svg -e tmp/panel.png -d 90 -a 256:256:512:512 -y 0 -b "#000000" 1>/dev/null 2>/dev/null | ||
if [ -e tmp/panel.png ]; then | ||
if [ $(stat tmp/panel.png | cut -f 8 -d' ') -ge 410 ]; then | ||
../searender/searender ../searender/symbols/symbols.defs 9 $bb9 >tmp/panel.svg <tmp/panel-z9.osm | ||
inkscape tmp/panel.svg -e tmp/tiles-9-$tx9-$ty9.png -d 11.25 -a 256:256:2304:2304 -y 0 -b "#000000" 1>/dev/null 2>/dev/null | ||
../searender/searender ../searender/symbols/symbols.defs 10 $bb10 >tmp/panel.svg <tmp/panel-z10.osm | ||
inkscape tmp/panel.svg -e tmp/tiles-10-$tx10-$ty10.png -d 22.5 -a 256:256:1280:1280 -y 0 -b "#000000" 1>/dev/null 2>/dev/null | ||
../searender/searender ../searender/symbols/symbols.defs 11 $bb11 >tmp/panel.svg <tmp/panel-z11.osm | ||
inkscape tmp/panel.svg -e tmp/tiles-11-$tx11-$ty11.png -d 45 -a 256:256:768:768 -y 0 -b "#000000" 1>/dev/null 2>/dev/null | ||
cp tmp/panel-z12.osm tmp/$tx\_$ty\_$bb\_12.osm | ||
fi | ||
fi | ||
fi | ||
fi | ||
done | ||
done | ||
} | ||
|
||
if [ $# -eq 0 ]; then | ||
if [ -e datestamp ]; then | ||
previous=$(cat datestamp) | ||
else | ||
previous=0000-00-00T00:00:00Z | ||
fi | ||
elif [ $# -eq 1 ]; then | ||
previous=$1 | ||
else | ||
previous=0000-00-00T00:00:00Z | ||
fi | ||
|
||
if [ $# -eq 3 ]; then | ||
cp tmp/panel-z0.osm tmp/panel-z$1.osm | ||
search $1 $2 $3 | ||
echo "$(date) Rendering of $1 $2 $3 complete" >> log.txt | ||
exit | ||
fi | ||
|
||
while true; do | ||
while [ ! -e next.osm ]; do | ||
sleep 10 | ||
done | ||
echo "$(date) Parse world data" >> log.txt | ||
cp next.osm world.osm | ||
if [ $(echo $(date "+%M"|sed 's/^0//')) -lt 5 ]; then | ||
java -jar jharbour.jar <world.osm >harbours.xml | ||
scp -q -C -P 2215 harbours.xml [email protected]:~/tiles/ | ||
|
@@ -94,15 +14,14 @@ while true; do | |
echo "$(date) World uploaded" >> log.txt | ||
fi | ||
fi | ||
mv next.osm tmp/panel-z0.osm | ||
search 0 0 0 | ||
latest=$previous | ||
timestamp=$(../util/checkdate world.osm) | ||
if [ $timestamp \> $latest ]; then | ||
latest=$timestamp; | ||
fi; | ||
echo "$latest" > datestamp | ||
echo "$(date) Rendering queued to latest timestamp: $latest" >> log.txt | ||
diff world.osm next.osm | grep id= | grep -v "<tag" > diffs | ||
java -jar jsearch.jar ./ | ||
mv next.osm world.osm | ||
if [ -s diffs ]; then | ||
echo "$(date) New rendering queued" >> log.txt | ||
else | ||
echo "$(date) No changes" >> log.txt | ||
fi | ||
if [ -e stop ]; then | ||
echo "$(date) Stopped" >> log.txt | ||
exit | ||
|
@@ -114,9 +33,4 @@ while true; do | |
done | ||
echo "$(date) Resumed" >> log.txt | ||
fi | ||
latest=$(cat datestamp) | ||
# if [ $previous == $latest ]; then | ||
# sleep 900 | ||
# fi | ||
previous=$latest | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
date;rsync -ra -e ssh --delete tiles/* [email protected]:~/tiles/;date | ||
date;rsync -rz --delete -e 'ssh -p 2215' tiles/ [email protected]:~/tiles/;date |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,25 +3,11 @@ | |
while true; do | ||
sleep 1 | ||
if [ -e tmp/sending ]; then | ||
backoff=0 | ||
while ! sftp -q -C -P 2215 -b tmp/sending [email protected]>/dev/null; do | ||
echo "SFTP failure - retrying" | ||
touch hold | ||
backoff=$(($backoff+1)) | ||
sleep $((60*$backoff)) | ||
done | ||
sftp -q -B 131072 -P 2215 -b tmp/sending [email protected]>/dev/null | ||
rm tmp/sending | ||
rm -f hold | ||
echo $(date) Sent | ||
sleep 3 | ||
fi | ||
while [ -e tmp/deletions ]; do | ||
mv tmp/deletions tmp/deleting | ||
sftp -q -C -P 2215 -b tmp/deleting [email protected]>/dev/null | ||
rm tmp/deleting | ||
echo $(date) Deleted | ||
sleep 1 | ||
done | ||
if [ $(ls tmp | grep -c '.send') -ne 0 ]; then | ||
for file in $(ls tmp | grep '.send'); do | ||
mv tmp/$file tmp/send | ||
|