TileStache.Goodies.Providers.UtfGridComposite module

Composite Provider for UTFGrid layers https://github.com/mapbox/utfgrid-spec/blob/master/1.2/utfgrid.md

Combines multiple UTFGrid layers to create a single result. The given layers will be added to the result in the order they are given. Therefore the last one will have the highest priority.

Sample configuration:

“provider”: {

“class”: “TileStache.Goodies.Providers.UtfGridComposite:Provider”, “kwargs”: {

“stack”: [

{ “layer_id”: “layer1”, “src”: “my_utf_layer1”, “wrapper”: “grid” }, { “layer_id”: “layer2”, “src”: “my_utf_layer2”, “wrapper”: “grid” }

], “layer_id”: “l”, “wrapper”: “grid”

}

}

stack: list of layers (and properties) to composite together
layer_id: an id attribute that will be added to each json data object for this layer: { “layer_id”: “layer1”, “name”: “blah”, “address”: “something”} src: layer name of the layer to composite wrapper: the wrapper definition of this layer if there is one (so we can remove it)

layer_id: the key for the layer_id attribute that is added to each data object: { “l”: “layer1”, ...} wrapper: wrapper to add to the resulting utfgrid “WRAPPER({...})”. Usually “grid”

if layer_id is not set in the layer or the provider config then it will not be set on data objects

class TileStache.Goodies.Providers.UtfGridComposite.Provider(layer, stack, layer_id=None, wrapper=None)
addLayer(resultGrid, gridKeys, gridData, layerDef, coord)
decodeId(id)
encodeId(id)
getTypeByExtension(extension)

Get mime-type and format by file extension. This only accepts “json”.

renderTile(width, height, srs, coord)
writeResult(resultGrid, gridKeys, gridData)
class TileStache.Goodies.Providers.UtfGridComposite.SaveableResponse(content)

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.

save(out, format)