TileCache Caches

TileCache offers access to a number of different caches. These caches are used to store tiles.


Example Configuration:


Dependencies: None

The sendfile=yes option instructs TileCache to send an X-SendFile header to the web server rather than the contents of the image.

See http://blog.lighttpd.net/articles/2006/07/02/x-sendfile and http://tn123.ath.cx/mod_xsendfile/


Example Configuration:


Dependencies: None Note: A simple subclass of the Disk cache, this switches the Y tile ordering on the disk, so Google Maps users can easily access tiles directly (e.g. bypassing tilecache.py, if all tiles have been pre-rendered) with a simple CustomTileUrl function.


Example configuration:


Amazon S3

Example configuration:


The use_tms_paths will make the files more accessible to other clients, though at this time, ACLs are not set on the TMS structure to make them available publicly.

The use_tms_paths can also be set to “flipped”: if so, it will result in ‘flipped’ TMS, with typical paths like:


But with 0 starting at the top of the map, instead of the bottom.

This cache can use one of two libraries:


Available from http://code.google.com/p/boto/, boto is a package that wraps the Amazon APIs in a Pythonic wrapper. This is installable on recent Debian-based distributions as python-boto. It can be installed via easy_install from setuptools as well: simply easy_install boto. The boto library is more complete, and is more likely to properly handle error conditions than the Amazon Example Library.

Amazon Example Library

Amazon provides an example Python library. This library provides a simple wrapper around the Amazon web services. The code is available from http://developer.amazonwebservices.com/connect/entry.jspa?externalID=134&categoryID=47

You must download, unpack, and place the s3-example-libraries/python/S3.py file on your PYTHONPATH/sys.path. The source distribution of TileCache includes this file in the TileCache/Caches/S3.py file. (Packagers are encouraged to remove this file from distributions and instead depend on the boto library described above.)


Simple read-only format for MBTiles sqlite databases. Name each database according to the name of the layer, and place it inside your cache directory, and provide an extension to your cache.

[cache] type=MBTiles base=./tiles ext=db

For layer basic, this will attempt to open a sqlite3 database at ./tiles/basic.db .

See http://mapbox.com/tools/mbtiles for more details.

All Caches

All Caches support the expire option.

The expire=n option instructs TileCache to send an Expires header, with the date set ‘n’ seconds into the future.

Table Of Contents

Previous topic

Getting Started

Next topic

Layer Examples

This Page