.\" Man page generated from reStructeredText.
.TH tilecache 8 "2007-04-05" "1.6" "GIS Utilities"
.SH NAME
tilecache \- Cache and serve map tiles
.SH DESCRIPTION
TileCache is a BSD licensed tile caching mechanism. The goal is to make it
easy to set up a WMS or TMS frontend to any backend data services you might be
interested in, using a pluggable caching and rendering mechanism.
This package implements the WMS\-C server recommendation as defined by
http://wiki.osgeo.org/index.php/WMS_Tiling_Client_Recommendation, and the
Tiled Map Service specification available at
http://wiki.osgeo.org/index.php/Tile_Map_Service_Specification.
TileCache will run under Python CGI or mod_python.
Backend rendering can be powered by remote, or cascading, WMS requests, or by
MapServer rendering via python\-mapscript. Support for other rendering engines
can be added with the implementation of a single function.
Caches can be maintained on disk, or via the memcached memory\-based LRU
caching daemon.
TileCache was developed by MetaCarta Labs and released to the public under a
BSD license. For updates on tools released by MetaCarta Labs, you can subscribe
to the Labs Announce list, available at
http://labs.metacarta.com/mailman/listinfo/announce.
The TileCache was designed as a companion to OpenLayers, the BSD licensed web
mapping interface. For help with setting up TileCache for use with OpenLayers,
please feel free to stop by #openlayers, on irc.freenode.net, or to send email
to labs@metacarta.com.
.SH RUNNING UNDER CGI
.TP 2
\(bu
Extract the code to some web directory (e.g. in /var/www).
.TP 2
\(bu
Edit tilecache.cfg to point the DiskCache to the location you wish
to cache tiles, and the layers to point to the map file or WMS
server you wish to cache. On Debian, this file is in /etc/tilecache.cfg
by default.
.TP 2
\(bu
Permit CGI execution in the TileCache directory.
For example, if TileCache is to be run with Apache, the
following must be added in your Apache configuration,
where /var/www/tilecache is the directory resulting from
the code extraction. On Debian, this is typically /usr/lib/cgi\-bin.
.nf
AddHandler cgi\-script .cgi
Options +ExecCGI
.fi
.TP 2
\(bu
Visit:
http://example.com/yourdir/tilecache.cgi?LAYERS=basic&SERVICE=WMS
&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&BBOX=\-180,\-90,0,90
&WIDTH=256&HEIGHT=256
.TP 2
\(bu
Or visit:
http://example.com/yourdir/tilecache.cgi/1.0.0/basic/0/0/0.png
.TP 2
\(bu
If you see a tile you have set up your configuration correctly. Congrats!
.SS Non\-standard Python Location
If your Python is not at /usr/bin/python on your system, you will need to
change the first line of tilecache.cgi to reference the location of your Python
binary. A common example is:
.\" visit_block_quote
.nf
#!/usr/local/bin/python
.fi
.\" depart_block_quote
Under Apache, you might see an error message like:
.\" visit_block_quote
.nf
[Wed Mar 14 19:55:30 2007] [error] [client 127.0.0.1] (2)No such file or
directory: exec of \'/www/tilecache.cgi\' failed
.fi
.\" depart_block_quote
to indicate this problem.
You can typically locate where Python is installed on your system via the
command which python.
Windows users: If you are using Windows, you should change the first line
of tilecache.cgi to read:
.\" visit_block_quote
.nf
#!C:/Python/python.exe \-u
.fi
.\" depart_block_quote
C:/Python should match the location Python is installed under on your
system. In Python 2.5, this location is C:/Python25 by default.
.SH RUNNING UNDER MOD_PYTHON
.TP 2
\(bu
Extract the code to some web directory (e.g. /var/www).
.TP 2
\(bu
Edit tilecache.cfg to point the DiskCache to the location you wish
to cache tiles, and the layers to point to the map file or WMS
server you wish to cache
.TP 2
\(bu
Add the following to your Apache configuration, under a heading:
.nf
AddHandler python\-program .py
PythonHandler TileCache.Service
PythonOption TileCacheConfig /path/to/tilecache.cfg
.fi
.TP 2
\(bu
An example might look like:
.nf
AddHandler python\-program .py
PythonHandler TileCache.Service
PythonOption TileCacheConfig /var/www/tilecache/tilecache.cfg
.fi
.TP 2
\(bu
In this example, /var/www/tilecache is the directory resulting from
the code extraction. If you\'ve installed this from a Debian package, the
location of your .cfg file is probably /etc/tilecache.cfg.
.TP 2
\(bu
Visit one of the URLs described above, replacing tilecache.cgi with
tilecache.py
.TP 2
\(bu
If you see a tile you have set up your configuration correctly. Congrats!
.SH RUNNING STANDALONE (UNDER WSGI)
TileCache as of version 1.4 comes with a standalone HTTP server which uses
the WSGI handler. This implementation depends on
.I Python Paste
, which can be
downloaded from:
.\" visit_block_quote
http://cheeseshop.python.org/pypi/Paste
.\" depart_block_quote
For versions of Python earlier than 2.5, you will also need to install
wsgiref:
.\" visit_block_quote
http://cheeseshop.python.org/pypi/wsgiref
.\" depart_block_quote
Once you have all the prerequisites installed, simply run:
.\" visit_block_quote
.nf
python tilecache_http_server.py
.fi
.\" depart_block_quote
This will start a webserver listening on port 8080, after which you should
be able to open:
.\" visit_block_quote
.nf
http://hostname:8080/1.0.0/basic/0/0/0.png
.fi
.\" depart_block_quote
to see your first tile.
.SH RUNNING UNDER FASTCGI
TileCache as of version 1.4 comes with a fastcgi implementation. In
order to use this implementation, you will need to install flup, available
from:
.\" visit_block_quote
http://trac.saddi.com/flup
.\" depart_block_quote
This implementation also depends on Python Paste, which can be downloaded
from:
.\" visit_block_quote
http://cheeseshop.python.org/pypi/Paste
.\" depart_block_quote
Once you have done this, you can configure your fastcgi server to use
tilecache.fcgi.
Configuring FastCGI is beyond the scope of this documentation.
.SH RUNNING UNDER IIS
Installing TileCache for use with IIS requires some additional configuration.
.TP 2
\(bu
Install Python for Windows
.TP 2
\(bu
Follow "Using Python Scripts with IIS" to setup Python CGI for IIS.
http://support.microsoft.com/kb/276494
.TP 2
\(bu
Edit metabase.xml to get correct Security Permissions for IIS 6.0.
http://blogs.msdn.com/david.wang/archive/2005/04/20/IIS6\-CGI\-Web\-Service\-Extension.aspx
.TP 2
\(bu
Edit tilecache.cgi to specify your configuration file explicitly:
.nf
svc = Service.load("C:\\TileCache\\tilecache.cfg")
.fi
.SH CONFIGURATION
TileCache is configured by a config file, defaulting to tilecache.cfg.
There are several parameters to control TileCache layers that are applicable
to all layers:
.\" visit_block_quote
.TP
.B bbox
The bounding box of the Layer. The resolutions array defaults
to having resolutions which are equal to the bbox divided by
512 (two standard tiles).
.TP
.B debug
Whether to send debug output to the error.log. Defaults to "yes",
can be set to "no"
.TP
.B description
Layer description, used in some metadata responses. Default
is blank.
.TP
.B extension
File extension of the layer. Used to request images from
WMS servers, as well as when writing cache files.
.TP
.B layers
A string used to describe the layers. Typically passed directly
to the renderer. The WMSLayer sends this in the HTTP request,
and the MapServerLayer chooses which layer to render based on
this string. If no layer is provided, the layer name is used
to fill this property.
.TP
.B levels
An integer, describing the number of \'zoom levels\' or
scales to support. Overridden by resolutions, if passed.
.TP
.B mapfile
The absolute file location of a mapfile. Required for
MapServer and Mapnik layers.
.TP
.B maxResolution
The maximum resolution. If this is set, a resolutions
array is automatically calculated up to a number of
levels controlled by the \'levels\' option.
.TP
.B metaTile
set to "yes" to turn on metaTiling. This will request larger
tiles, and split them up using the Python Imaging library.
Defaults to "no".
.TP
.B metaBuffer
an integer number of pixels to request around the outside
of the rendered tile. This is good to combat edge effects
in various map renderers. Defaults to 10.
.TP
.B metaSize
A comma seperated pair of integers, which is used to
determine how many tiles should be rendered when using
metaTiling. Default is 5,5.
.TP
.B resolutions
Comma seperate list of resolutions you want the TileCache
instance to support.
.TP
.B size
Comma seperated set of integers, describing the width/height
of the tiles. Defaults to 256,256
.TP
.B srs
String describing the SRS value. Default is "EPSG:4326"
.TP
.B type
The type of layer. Options are: WMSLayer, MapnikLayer, MapServerLayer, ImageLayer
.TP
.B url
URL to use when requesting images from a remote WMS server. Required
for WMSLayer.
.\" depart_block_quote
.SH USING TILECACHE WITH OPENLAYERS
To run OpenLayers with TileCache the URL passed to the OpenLayers.Layer.WMS
constructor must point to the TileCache script, i.e. tilecache.cgi or
tilecache.py. As an example see the index.html file included in the TileCache
distribution.
Note: index.html assumes TileCache is set up under CGI (see above). If you set
up TileCache under mod_python you\'d need to slighly modify index.html: the URL
passed to the OpenLayers.Layer.WMS constructor must point to the mod_python
script as opposed to the CGI script, so replace tilecache.cgi with
tilecache.py. Similarly, you would need to edit this URL if you were to use
TileCache with the standalone HTTP Server or FastCGI.
The most important thing to do is to ensure that the OpenLayers Layer
has the same resolutions and bounding box as your TileCache layer. You can define
the resolutions in OpenLayers via the \'resolutions\' option or the \'maxResolution\'
option on the layer. The maxExtent should be defined to match the bbox parameter
of the TileCache layer.
If you are using TileCache for overlays, you should set the \'reproject\' option
on the layer to \'false\'.
.SH SEEDING YOUR TILECACHE
The tilecache_seed.py utility will seed tiles in a cache automatically. You will
need to have TileCache set up in one of the previously described configurations.
.SS Usage
.\" visit_block_quote
tilecache_seed.py [ []]
.\" depart_block_quote
.SS Arguments
.\" visit_block_quote
.TP
.B url
http://example.com/yourdir/tilecache.cgi? or
http://example.com/yourdir/tilecache.py
.TP
.B layer
same layer name that is in the tilecache.cfg
.TP
.B zoom start
Zoom level to start the process
.TP
.B zoom end
Zoom level to end the process
.TP
.B bbox
The bounding box to seed
.\" depart_block_quote
.SS Seeding by center point and radius
If called without zoom level arguments, tilecache_seed.py will assume
that it needs to read a list of points and radii from standard input,
in the form:
.\" visit_block_quote
.nf
,,
,,
,,
,,
.fi
.\" depart_block_quote
The format of this file is:
.\" visit_block_quote
.TP
.B lon
the position(s) to seed longitude
.TP
.B lat
the position(s) to seed latitude
.TP
.B radius
the radius around the lon/lat to seed in degrees
.\" depart_block_quote
.SS Examples
An example with zoom levels 5 through 12 would be like;
.\" visit_block_quote
.nf
$ tilecache_client.py "http://example.com/yourdir/tilecache.cgi?" Zip_Codes 5 12 "\-118.12500,31.952162238,\-116.015625,34.3071438563"
.fi
.\" depart_block_quote
The bbox can be dropped and defaults to world lonlat(\-180,\-90,180,90):
.\" visit_block_quote
.nf
$ tilecache_client.py "http://example.com/yourdir/tilecache.cgi?" Zip_Codes 0 9
.fi
.\" depart_block_quote
In center point/radius mode, the zoom level range is not specifiable from the
command\-line. An example usage might look like:
.\" visit_block_quote
.nf
$ tilecache_client.py "http://example.com/yourdir/tilecache.cgi?" Zip_Codes
\-118.12500,31.952162238,0.05
\-121.46327,32.345345645,0.08
.fi
.\" depart_block_quote
... the seeding will then commence ...
.SH CLEANING YOUR TILECACHE
The tilecache_clean.py utility will remove the least recently accessed
tiles from a cache, down to a specified size.
.SS Usage
.\" visit_block_quote
tilecache_clean.py [options]
.\" depart_block_quote
.SS Options
.\" visit_block_quote
.TP
.B \-\-version
show program\'s version number and exit
.TP
.B \-h , \-\-help
show this help message and exit
.TP
.BI \-s\ SIZE ,\ \-\-size\ SIZE
Maximum cache size, in megabytes.
.TP
.BI \-e\ ENTRIES ,\ \-\-entries\ ENTRIES
Maximum cache entries. This limits the
amount of memory that will be used to store
information about tiles to remove.
.\" depart_block_quote
.SS Notes
The \-\-entries option to tilecache_clean.py is optional, and is used to regulate
how much memory it uses to do its bookkeeping. The default value of 1 million
will hopefully keep RAM utilization under about 100M on a 32\-bit x86 Linux
machine. If tilecache_clean.py doesn\'t appear to be keeping your disk cache
down to an appropriate size, try upping this value.
tilecache_clean.py is designed to be run from a cronjob like so:
.\" visit_block_quote
.nf
00 05 * * * /usr/local/bin/tilecache_clean.py \-s500 /var/www/tilecache
.fi
.\" depart_block_quote
Note that, on non\-POSIX operating systems (particularly Windows),
tilecache_clean.py measures file sizes, and not disk usage. Because most
filesystems use entire file blocks for files smaller than a block, running du
\-s or similar on your disk cache after a cleaning may still return a total
cache size larger than you expect.
.SH SEE ALSO
memcached(8)
http://tilecache.org/
http://openlayers.org/
http://wiki.osgeo.org/index.php/WMS_Tiling_Client_Recommendation
http://wiki.osgeo.org/index.php/Tile_Map_Service_Specification
.SH AUTHOR
labs@metacarta.com
.SH COPYRIGHT
(c) 2006-2007 MetaCarta, Inc.
Distributed under the BSD license.
.\" Generated by docutils manpage writer on 2007-04-05 17:54.
.\"