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

 
Classes
       
EmptyResponse
Provider
Response

 
class EmptyResponse
    Simple empty response renders valid MVT or GeoJSON with no features.
 
  Methods defined here:
save(self, out, format)

 
class Provider
    VecTiles provider for PostGIS data sources.
 
Parameters:
 
  queries:
    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 can additionally be a file name or URL, interpreted
    relative to the location of the TileStache config file.
 
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":
    {
      "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, queries)
getTypeByExtension(self, extension)
Get mime-type and format by file extension, one of "mvt" or "json".
renderTile(self, width, height, srs, coord)
Render a single tile, return a Response instance.

 
class Response
     Methods defined here:
__init__(self, db, subquery, bbox, tolerance)
save(self, out, format)

 
Functions
       
build_query(subquery, bbox, tolerance, is_geo=False, is_clipped=True)
Build and return an PostGIS query.
connect(*args, **kwargs)

 
Data
        err = ImportError('No module named psycopg2.extras',)
pi = 3.1415926535897931
tolerances = [156543.03392804097, 78271.516964020484, 39135.758482010242, 19567.879241005121, 9783.9396205025605, 4891.9698102512803, 2445.9849051256401, 1222.9924525628201, 611.49622628141003, 305.74811314070502, 152.87405657035251, 76.437028285176254, 38.218514142588127, 19.109257071294063, 9.5546285356470317, 4.7773142678235159, 2.3886571339117579, 1.194328566955879, 0.59716428347793948, 0.29858214173896974]
zoom = 19