pixelplanet/utils/osm-tiles
2020-01-02 17:58:06 +01:00
..
borders-combined.png Mirror repository for github 2020-01-02 17:58:06 +01:00
LICENSE Mirror repository for github 2020-01-02 17:58:06 +01:00
overview.png Mirror repository for github 2020-01-02 17:58:06 +01:00
README.md Mirror repository for github 2020-01-02 17:58:06 +01:00

OSM tiles

This osm tiles and pictures are just informational, they don't get used for creating the map on directly on pixelplanet.fun.

Download zoomlevel 5

  1. download tiles
for i in {0..31}; do mkdir $i; for u in {0..31}; do wget https://b.tile.thunderforest.com/mobile-atlas/5/$i/$u.png?apikey=7c352c8ff1244dd8b732e349e0b0fe8d -O $i/$u.png; done ; done
  1. combine tiles
for i in {0..31}; do convert -append "$i/%d.png[0-31]" $i.png; done
convert +append "%d.png[0-31]" out.png
  1. fix to our custom projection
  • scale x: 1
  • scale y: 1060 / 1024 = 530 / 512 = 265 / 256
  • centered
convert out.png -resize 8192x8480\! final.png
# (8480 - 8192) / 2 = 144
mogrify -shave 0x144 final.png
  1. clean up
for i in {0..31}; do rm $i.png; done
for i in {0..31}; do rm -r $i; done
rm out.png

Download zoomlevel 8

  1. downloading it in columns
mkdir tmp
for i in {0..255}; do for u in {0..255}; do wget https://a.tile.openstreetmap.org/8/$i/$u.png -O tmp/$u.png; done; convert -append "tmp/%d.png[0-255]" $i.png; rm tmp/*; done
rm -r tmp
  1. conbining straps t 2048 width, fix scale to our projection like above with zoomlevel 5
for i in {0..31}; do LOW=$(expr $i "*" 8); UP=$(expr $LOW + 7); echo "Generating s$i.png from $LOW to $UP"; convert +append "%d.png[${LOW}-${UP}]" s$i.png; done
  1. delete old stripes
for i in {0..255}; do rm $i.png; done
  1. convert to our projection
for i in {0..31}; do echo "Generating c$i.png"; convert s$i.png -resize 2048x67840\! -shave 0x1152 c$i.png; done
  1. create subfolders for tiles
mkdir osm
for i in {0..31}; do mkdir osm/$i; done
  1. split into tiles
for i in {0..32}; do echo "Generating tiles for x=$i"; convert c$i.png -crop 2048x2048 +adjoin osm/$i/%02d.png; done
  1. clean up
rm s*.png
rm c*.png