Python: module TileStache.Goodies.VecTiles.server

TileStache.Goodies.VecTiles.server | index

`Provider that returns PostGIS vector tiles in GeoJSON or MVT format.
VecTiles is intended for rendering, and returns tiles with contents simplified,
precision reduced and often clipped. The MVT format in particular is designed
for use in Mapnik with the VecTiles Datasource, which can read binary MVT tiles.
For a more general implementation, try the Vector provider:
http://tilestache.org/doc/#vector-provider`

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

Classes
`` |  | Connection EmptyResponse MultiProvider MultiResponse Provider Response
class Connection
`` | `Context manager for Postgres connections. See http://www.python.org/dev/peps/pep-0343/ and http://effbot.org/zone/python-with-statement.htm`
| Methods defined here: __enter__(self) __exit__(self, type, value, traceback) __init__(self, dbinfo)
class EmptyResponse
`` | `Simple empty response renders valid MVT or GeoJSON with no features.`
| Methods defined here: __init__(self, bounds) save(self, out, format)
class MultiProvider
`` | `VecTiles provider to gather PostGIS tiles into a single multi-response. Returns a MultiResponse object for GeoJSON or TopoJSON requests. names: List of names of vector-generating layers from elsewhere in config. Sample configuration, for a layer with combined data from water and land areas, both assumed to be vector-returning layers: "provider": { "class": "TileStache.Goodies.VecTiles:MultiProvider", "kwargs": { "names": ["water-areas", "land-areas"] } }`
| Methods defined here: __init__(self, layer, names) getTypeByExtension(self, extension) `Get mime-type and format by file extension, "json" or "topojson" only.` renderTile(self, width, height, srs, coord) `Render a single tile, return a Response instance.`
class MultiResponse
`` |  | Methods defined here: __init__(self, config, names, coord) `Create a new response object with TileStache config and layer names.` save(self, out, format)
class Provider
`` | `VecTiles provider for PostGIS data sources. Parameters: dbinfo: Required dictionary of Postgres connection parameters. Should include some combination of 'host', 'user', 'password', and 'database'. queries: Required list of Postgres queries, one for each zoom level. The last query in the list is repeated for higher zoom levels, and null queries indicate an empty response. Query must use "__geometry__" for a column name, and must be in spherical mercator (900913) projection. A query may include an "__id__" column, which will be used as a feature ID in GeoJSON instead of a dynamically-generated hash of the geometry. A query can additionally be a file name or URL, interpreted relative to the location of the TileStache config file. If the query contains the token "!bbox!", it will be replaced with a constant bounding box geomtry like this: "ST_SetSRID(ST_MakeBox2D(ST_MakePoint(x, y), ST_MakePoint(x, y)), <srid>)" This behavior is modeled on Mapnik's similar bbox token feature: https://github.com/mapnik/mapnik/wiki/PostGIS#bbox-token clip: Optional boolean flag determines whether geometries are clipped to tile boundaries or returned in full. Default true: clip geometries. srid: Optional numeric SRID used by PostGIS for spherical mercator. Default 900913. simplify: Optional floating point number of pixels to simplify all geometries. Useful for creating double resolution (retina) tiles set to 0.5, or set to 0.0 to prevent any simplification. Default 1.0. simplify_until: Optional integer specifying a zoom level where no more geometry simplification should occur. Default 16. Sample configuration, for a layer with no results at zooms 0-9, basic selection of lines with names and highway tags for zoom 10, a remote URL containing a query for zoom 11, and a local file for zooms 12+: "provider": { "class": "TileStache.Goodies.VecTiles:Provider", "kwargs": { "dbinfo": { "host": "localhost", "user": "gis", "password": "gis", "database": "gis" }, "queries": [ null, null, null, null, null, null, null, null, null, null, "SELECT way AS __geometry__, highway, name FROM planet_osm_line -- zoom 10+ ", "http://example.com/query-z11.pgsql", "query-z12-plus.pgsql" ] } }`
| Methods defined here: __init__(self, layer, dbinfo, queries, clip=True, srid=900913, simplify=1.0, simplify_until=16) getTypeByExtension(self, extension) `Get mime-type and format by file extension, one of "mvt", "json" or "topojson".` renderTile(self, width, height, srs, coord) `Render a single tile, return a Response instance.`
class Response
`` |  | Methods defined here: __init__(self, dbinfo, srid, subquery, columns, bounds, tolerance, zoom, clip) `Create a new response object with Postgres connection info and a query. bounds argument is a 4-tuple with (xmin, ymin, xmax, ymax).` save(self, out, format)

Functions
`` |  | build_query(srid, subquery, subcolumns, bbox, tolerance, is_geo, is_clipped) `Build and return an PostGIS query.` connect(*args, **kwargs) query_columns(dbinfo, srid, subquery, bounds) `Get information about the columns returned for a subquery.`

Data
`` |  | err = ImportError('No module named psycopg2.extras',) pi = 3.141592653589793 tolerances = [156543.03392804097, 78271.51696402048, 39135.75848201024, 19567.87924100512, 9783.93962050256, 4891.96981025128, 2445.98490512564, 1222.99245256282, 611.49622628141, 305.748113140705, 152.8740565703525, 76.43702828517625, 38.21851414258813, 19.109257071294063, 9.554628535647032, 4.777314267823516, 2.388657133911758, 1.194328566955879, 0.5971642834779395, 0.29858214173896974] zoom = 19