Ghini / ghini.web

web and geo interface to ghini.desktop database
GNU Affero General Public License v3.0
4 stars 1 forks source link

produce tiles at higher resolution #12

Closed mfrasca closed 7 years ago

mfrasca commented 7 years ago

we can rely on openstreetmap.org and openstreetmap.fr for tiles up to zoom 19 or 20, but for deeper zoom levels, we need keep our own tiles. for the cuchubo prototype we used to reach zoom 22, and we produced that from a very high resolution map of the garden, but I did not put the script under version control so I don't know any more. I think I was using a svg image, and the imagemagick suite.

mfrasca commented 7 years ago

just for the very most urgent time being, work on this:

step 1: download the tiles from openstreetmap, at zoom 19, for example talking about parque centenario:

z=19
for x in $(seq 152116 152121 ); do 
  for y in $(seq 246879 246881 ); do 
    wget http://c.tile.osm.org/$z/$x/$y.png -O $z.$x.$y.png; 
  done; 
done

step 2: split each image in four after doubling the size, and remember to remove the offset information from it. this is quite generic and you need repeat this from 19 to 20, then from 20 to 21 and from 21 to 22. the result is quite crude anyway:

for n in *.*.*.png
do
  z=$(echo $n | cut -d. -f 1)
  mkdir -p ../tiles-$(( z + 1 ))
  x=$(echo $n | cut -d. -f 2)
  y=$(echo $n | cut -d. -f 3)
  for dx in 0 1; do 
    for dy in 0 1; do 
      convert $z.$x.$y.png \
          -scale 512x512 \
          -crop 256x256+$(( dx * 256 ))+$(( dy * 256 )) \
          +repage \
          ../tiles-$(( z + 1 ))/$(( z + 1 )).$(( x * 2 + dx )).$(( y * 2 + dy )).png
      echo convert $z.$x.$y.png \
          -scale 512x512 \
          -crop 256x256+$(( dx * 256 ))+$(( dy * 256 )) \
          +repage \
          ../tiles-$(( z + 1 ))/$(( z + 1 )).$(( x * 2 + dx )).$(( y * 2 + dy )).png
    done
  done
done