-
Notifications
You must be signed in to change notification settings - Fork 50
TileStache
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
###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.
Then 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
sudo -u www-data tilestache-seed.py -b 22.2 -126.9 40.0 -67.2 -c tilestache.cfg -l hybrid 4