Skip to content
nvkelso edited this page Mar 9, 2012 · 16 revisions

A stylish alternative for caching your map tiles. TileStache is a Python-based server application that can serve up map tiles 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 ».

  • 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

###Usage

Background:

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

/layername/preview.html

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

#12/37.8110/-122.2660

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

ifconfig

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

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

The in your web browser:

http://192.168.1.5:4132/{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

Clone this wiki locally