Generating OSM tiles with Python to Windows Azure Blob storage
The concept is to generate the tiles for an OpenStreetMap or OpenSeaMap server published to Windows Azure. The advantage of Windows Azure Blob storage is that we can enable the CDN support (content delivery network) to send the tiles more quickly to the visitor.
Download winazurestorage.py and modify it in 3 places to hold your account keys and change the functions to use the real storage and not the development versions. Don’t change the CLOUD_BLOB_HOST value!
DEVSTORE_ACCOUNT=”youraccountname”
DEVSTORE _SECRET_KEY=”yoursecretkey”
Class BlobStorage, change the host to CLOUD_BLOB_HOST
Test winazurestorage.py by calling test.py.
Create a Windows Azure blob container (in this scenario named “testcontainer”)
edit “generate_tiles.py”
Add the following at the top:
from windowsazurestorage import *
find the function “def render_tiles” and at the last line after the im.save(tile_uri,’png256′) add:
blobs = BlobStorage()
name = str(z) + “/” + str(x) + “/” + str(y) + “.png”
blobs.put_blob(“testcontainer”, name, im.tostring(‘png256′), “image/png”)
Run generate_tiles.py and watch the tiles appear in your Azure Blob Storage