Python: module TileStache.Goodies.Providers.MapnikGrid

TileStache.Goodies.Providers.MapnikGrid | index

`Mapnik UTFGrid Provider.
Takes the first layer from the given mapnik xml file and renders it as UTFGrid
https://github.com/mapbox/utfgrid-spec/blob/master/1.2/utfgrid.md
It can then be used for this:
http://mapbox.github.com/wax/interaction-leaf.html
Only works with mapnik>=2.0 (Where the Grid functionality was introduced)
Use Sperical Mercator projection and the extension "json"
Sample configuration:
"provider":
{
"class": "TileStache.Goodies.Providers.MapnikGrid:Provider",
"kwargs":
{
"mapfile": "mymap.xml",
"fields":["name", "address"],
"layer_index": 0,
"wrapper": "grid",
"scale": 4
}
}
mapfile: the mapnik xml file to load the map from
fields: The fields that should be added to the resulting grid json.
layer_index: The index of the layer you want from your map xml to be rendered
wrapper: If not included the json will be output raw, if included the json will be wrapped in "wrapper(JSON)" (for use with wax)
scale: What to divide the tile pixel size by to get the resulting grid size. Usually this is 4.
buffer: buffer around the queried features, in px, default 0. Use this to prevent problems on tile boundaries.`

Modules
`` |  |
json |  |  |

Classes
`` |  | Provider SaveableResponse
class Provider
`` |  | Methods defined here: __init__(self, layer, mapfile, fields, layer_index=0, wrapper=None, scale=4, buffer=0) getTypeByExtension(self, extension) `Get mime-type and format by file extension. This only accepts "json".` renderTile(self, width, height, srs, coord)
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) save(self, out, format)