nvkelso edited this page Jun 8, 2012 · 16 revisions

A stylish alternative for caching your map tiles. TileStache is a Python-based server application that can pre-cache static assets or serve up map tiles live based on rendered geographic data.

It’s an open source WMS server that is simple and suited to the needs of designers and cartographers. Read the TileStache documentation ».

The name is a riff on TileCache, a historically more-popular utility that does the same thing. Stamen wrote their own to allow flexible customization, allowing them to build maps like Terrain or Water which are not well-supported by TileCache. More background »

  • Preview a map stylesheet during development
  • Render tiles to disk (cache)
  • Stream raster tile data
  • Stream vector tile data

Download and install

easy_install tilestache



TileStache URLs are based on a simplified TMS scheme:

/{layer name}/{zoom}/{column}/{row}.{extension}

To preview tiles:

Start the mini server and then view using the preview.html hook. Inside your project directory you'll setup a cgi and load the page in your web browser. Append


Note, the hash bit after the .html tracks the zoom, lat and long so you can bookmark share the current view.


For example, let's find out the intranet IP of the machine:


gunicorn -b "TileStache:WSGITileServer('tilestache.cfg')"

Note: Choose a port number that is on the lower side. Ones in the 90000 range don't work.

Then in your web browser:{layername}/preview.html

To cache tiles:

Tilestache-seed.py (doc) reads a configuration file, you specify which layer and a bounding box with zooms. Sometimes permissions can be an issue so these are run as a special user called www-data.

sudo -u www-data tilestache-seed.py -c tilestache.cfg -l hybrid -b -50 3 53.5 8 -x 7 8 9 10

sudo -u www-data tilestache-seed.py -c tilestache.cfg -l hybrid -b -52.27 4.71 52.47 5.06 -x 11 12

sudo -u www-data tilestache-seed.py -b 22.2 -126.9 40.0 -67.2 -c tilestache.cfg -l hybrid 4