| |
- Connection
- EmptyResponse
- MultiProvider
- MultiResponse
- Provider
- Response
class EmptyResponse |
|
Simple empty response renders valid MVT, GeoJSON, TopoJSON or PBF 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", "topojson" or "pbf" 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.
padding:
Optional number of pixels for applying a padding in the !bbox! token.
Useful if you want some buffer (common areas) between the tiles.
Default 0.
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"
]
}
}
The queries field has an alternate dictionary-like syntax which maps
zoom levels to their associated query. Zoom levels for which there is
no query may be omitted and are assumed null. This is equivalent to
the queries defined above:
"queries": {
"10": "SELECT way AS __geometry__, highway, name FROM planet_osm_line -- zoom 10+ ",
"11": "http://example.com/query-z11.pgsql",
"12": "query-z12-plus.pgsql"
}
Note that JSON requires keys to be strings, therefore the zoom levels
must be enclosed in quotes. |
|
Methods defined here:
- __init__(self, layer, dbinfo, queries, clip=True, srid=900913, simplify=1.0, simplify_until=16, padding=0)
- getTypeByExtension(self, extension)
- Get mime-type and format by file extension, one of "mvt", "json", "topojson" or "pbf".
- 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, coord, layer_name='', padding=0)
- 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)
| |