| |
- GridProvider
- ImageProvider
- SaveableResponse
class GridProvider |
|
Built-in UTF Grid provider. Renders JSON raster objects from Mapnik.
This provider is identified by the name "mapnik grid" in the
Tilestache config, and uses Mapnik 2.0 (and above) to generate
JSON UTF grid responses.
Sample configuration for a single grid layer:
"provider":
{
"name": "mapnik grid",
"mapfile": "world_merc.xml",
"fields": ["NAME", "POP2005"]
}
Sample configuration for multiple overlaid grid layers:
"provider":
{
"name": "mapnik grid",
"mapfile": "world_merc.xml",
"layers":
[
[1, ["NAME"]]
[0, ["NAME", "POP2005"]]
]
}
Arguments:
- mapfile (required)
Local file path to Mapnik XML file.
- fields (optional)
Array of field names to return in the response, defaults to all.
- layer index (optional)
Which layer from the mapfile to render, defaults to 0 (first layer).
- layers (optional)
Ordered list of (layer index, fields) to combine; if provided
layers overrides both layer index and fields arguments.
- scale (optional)
Scale factor of output raster, defaults to 4 (64x64).
Information and examples for UTF Grid:
- https://github.com/mapbox/utfgrid-spec/blob/master/1.2/utfgrid.md
- http://mapbox.github.com/wax/interaction-leaf.html |
|
Methods defined here:
- __init__(self, layer, mapfile, fields=None, layers=None, layer_index=0, scale=4)
- Initialize Mapnik grid provider with layer and mapfile.
XML mapfile keyword arg comes from TileStache config,
and is an absolute path by the time it gets here.
- getTypeByExtension(self, extension)
- Get mime-type and format by file extension.
This only accepts "json".
- renderArea(self, width, height, srs, xmin, ymin, xmax, ymax, zoom)
|
class ImageProvider |
|
Built-in Mapnik provider. Renders map images from Mapnik XML files.
This provider is identified by the name "mapnik" in the TileStache config.
Arguments:
- mapfile (required)
Local file path to Mapnik XML file.
- fonts (optional)
Local directory path to *.ttf font files.
More information on Mapnik and Mapnik XML:
- http://mapnik.org
- http://trac.mapnik.org/wiki/XMLGettingStarted
- http://trac.mapnik.org/wiki/XMLConfigReference |
|
Methods defined here:
- __init__(self, layer, mapfile, fonts=None)
- Initialize Mapnik provider with layer and mapfile.
XML mapfile keyword arg comes from TileStache config,
and is an absolute path by the time it gets here.
- renderArea(self, width, height, srs, xmin, ymin, xmax, ymax, zoom)
|
class SaveableResponse |
|
Wrapper class for JSON response that makes it behave like a PIL.Image object.
TileStache.getTile() expects to be able to save one of these to a buffer. |
|
Methods defined here:
- __init__(self, content, scale)
- crop(self, bbox)
- Return a cropped grid response.
- save(self, out, format)
| |