Python: module TileStache.Goodies.VecTiles.client

TileStache.Goodies.VecTiles.client | index

`Datasource for Mapnik that consumes vector tiles in GeoJSON or MVT format.
VecTiles provides Mapnik with a Datasource that can read remote tiles of vector
data in spherical mercator projection, providing for rendering of data without
the use of a local PostGIS database.
Sample usage in Mapnik configuration XML:
<Layer name="test" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs">
<StyleName>...</StyleName>
<Datasource>
<Parameter name="type">python</Parameter>
<Parameter name="factory">TileStache.Goodies.VecTiles:Datasource</Parameter>
<Parameter name="template">http://example.com/{z}/{x}/{y}.mvt</Parameter>
<Parameter name="sort_key">sort_key ascending</Parameter>
</Datasource>
</Layer>
From http://github.com/mapnik/mapnik/wiki/Python-Plugin:
The Mapnik Python plugin allows you to write data sources in the Python
programming language. This is useful if you want to rapidly prototype a
plugin, perform some custom manipulation on data or if you want to bind
mapnik to a datasource which is most conveniently accessed through Python.
The plugin may be used from the existing mapnik Python bindings or it can
embed the Python interpreter directly allowing it to be used from C++, XML
or even JavaScript.
See also:
http://mapnik.org/docs/v2.1.0/api/python/mapnik.PythonDatasource-class.html`

Modules
`` |  |
TileStache.Goodies.VecTiles.geojson | logging | TileStache.Goodies.VecTiles.mvt |

Classes
`` |  | __builtin__.object Datasource
class Datasource(__builtin__.object)
`` | `Mapnik datasource to read tiled vector data in GeoJSON or MVT formats. Sample usage in Mapnik configuration XML: <Layer name="test" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"> <StyleName>...</StyleName> <Datasource> <Parameter name="type">python</Parameter> <Parameter name="factory">TileStache.Goodies.VecTiles:Datasource</Parameter> <Parameter name="template">http://example.com/{z}/{x}/{y}.mvt</Parameter> <Parameter name="sort_key">sort_key ascending</Parameter> </Datasource> </Layer>`
| Methods defined here: __init__(self, template, sort_key=None, clipped='true', zoom_data='single') `Make a new Datasource. Parameters: template: Required URL template with placeholders for tile zoom, x and y, e.g. "http://example.com/layer/{z}/{x}/{y}.json". sort_key: Optional field name to use when sorting features for rendering. E.g. "name" or "name ascending" to sort ascending by name, "name descending" to sort descending by name. clipped: Optional boolean flag to determine correct behavior for duplicate geometries. When tile data is not clipped, features() will check geometry uniqueness and throw out duplicates. Setting clipped to false for actually-clipped geometries has no effect but wastes time. Setting clipped to false for unclipped geometries will result in possibly wrong-looking output. Default is "true". zoom_data: Optional keyword specifying single or double zoom data tiles. Works especially well with relatively sparse label layers. When set to "double", tiles will be requested at one zoom level out from the map view, e.g. double-sized z13 tiles will be used to render a normal z14 map. Default is "single".` features(self, query) Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`

Functions
`` |  | list_tiles(query, zoom_adjust) `Return a list of tiles (z, x, y) dicts for a mapnik Query object. Query is assumed to be in spherical mercator projection. Zoom_adjust is an integer delta to subtract from the calculated zoom.` load_features(jobs, host, port, path, tiles) `Load data from tiles to features. Calls load_tile_features() in a thread pool to speak HTTP.` load_tile_features(lock, host, port, path_fmt, tiles, features) `Load data from tiles to features. Called from load_features(), in a thread. Returns a list of (WKB, property dict) pairs.` utf8_keys(dictionary) `Convert dictionary keys to utf8-encoded strings for Mapnik. By default, json.load() returns dictionaries with unicode keys but Mapnik is ultra-whiny about these and rejects them.`

Data
`` |  | diameter = 40075016.68557849 meter_zoom = 17.25619978527 pi = 3.141592653589793