TileStache.Providers | index /home/migurski/public_html/TileStache/TileStache/Providers.py |
The provider bits of TileStache.
A Provider is the part of TileStache that actually renders imagery. A few default
providers are found here, but it's possible to define your own and pull them into
TileStache dynamically by class name.
Built-in providers:
- mapnik
- proxy
Example built-in provider, for JSON configuration file:
"layer-name": {
"provider": {"name": "mapnik", "mapfile": "style.xml"},
...
}
Example external provider, for JSON configuration file:
"layer-name": {
"provider": {"class": "Module.Classname", "kwargs": {"frob": "yes"}},
...
}
- The "class" value is split up into module and classname, and dynamically
included. If this doesn't work for some reason, TileStache will fail loudly
to let you know.
- The "kwargs" value is fed to the class constructor as a dictionary of keyword
args. If your defined class doesn't accept any of these keyword arguments,
TileStache will throw an exception.
A provider must offer one of two methods for rendering map areas.
The renderTile() method draws a single tile at a time, and has these arguments:
- width, height: in pixels
- srs: projection as Proj4 string.
"+proj=longlat +ellps=WGS84 +datum=WGS84" is an example,
see http://spatialreference.org for more.
- coord: Coordinate object representing a single tile.
The renderArea() method draws a variably-sized area, and is used when drawing
metatiles. It has these arguments:
- width, height: in pixels
- srs: projection as Proj4 string.
"+proj=longlat +ellps=WGS84 +datum=WGS84" is an example,
see http://spatialreference.org for more.
- xmin, ymin, xmax, ymax: coordinates of bounding box in projected coordinates.
- zoom: zoom level of final map. Technically this can be derived from the other
arguments, but that's a hassle so we'll pass it in explicitly.
Modules | ||||||
|
Classes | ||||||||||||||||||
|
Functions | ||
|