tilestrata-postgresql
A TileStrata plugin for serving the result of a custom SQL query as a tile when you need more control of the query than tilestrata-postgis-geojson-tiles or tilestrata-postgismvt.
Configuration
sql
(function, required): method that returns a PostGIS query that will be executed. Be sure to protect against sql injection if doing dynamic filtering based on the request query string. The query can contain the following tokens:{bbox}
(box2d): the tile bounding box{buffered_bbox}
(box2d): the buffered tile bounding box (usesconfig.buffer
){bbox_3857}
(box2d): the tile bounding box in Web Mercator Projection (EPSG:3857){buffered_bbox_3857}
(box2d): the buffered tile bounding box (usesconfig.buffer
) in Web Mercator Projection (EPSG:3857){z}
(int) : the tile zoom level{y}
(int) : the tile y coordinate{x}
(int) : the tile x coordinate
pgConfig
(object, required): postgres connection options{host}
(string){password}
(string){user}
(string){port}
(string){database}
(string)
contentType
(string, required): result MIME type (eg.application/x-protobuf
)formatResults
(function, required): method that returns a string or buffer when given a list of rows
Example
var tilestrataPostgreSQL = ; var layer = server; // .../vector-tiles/tile.pbflayer ;