All Projects → stepankuzmin → tilelive-postgis

stepankuzmin / tilelive-postgis

Licence: BSD-2-Clause License
Implements the tilelive API for generating vector tiles from PostGIS

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to tilelive-postgis

Tegola
Tegola is a Mapbox Vector Tile server written in Go
Stars: ✭ 754 (+1470.83%)
Mutual labels:  vector-tiles, postgis
cloud-tileserver
Serve mapbox vectortiles via AWS stack
Stars: ✭ 48 (+0%)
Mutual labels:  vector-tiles, postgis
Martin
Blazing fast and lightweight PostGIS vector tiles server
Stars: ✭ 540 (+1025%)
Mutual labels:  vector-tiles, postgis
Djangorestframework Mvt
Serve Mapbox Vector Tiles with Django and Postgres
Stars: ✭ 33 (-31.25%)
Mutual labels:  vector-tiles, postgis
Baremaps
Custom vector tiles from OpenStreetMap and other data sources.
Stars: ✭ 100 (+108.33%)
Mutual labels:  vector-tiles, postgis
timvt
PostGIS based Vector Tile server.
Stars: ✭ 113 (+135.42%)
Mutual labels:  vector-tiles, postgis
tilekiln
No description or website provided.
Stars: ✭ 3 (-93.75%)
Mutual labels:  vector-tiles, postgis
postile
Project migrated to: https://gitlab.com/Oslandia/postile
Stars: ✭ 67 (+39.58%)
Mutual labels:  vector-tiles, postgis
gsky
Distributed Scalable Geospatial Data Server
Stars: ✭ 23 (-52.08%)
Mutual labels:  postgis
gismanager
Publish Your GIS Data(Vector Data) to PostGIS and Geoserver
Stars: ✭ 45 (-6.25%)
Mutual labels:  postgis
qgis-bridge-plugin
GeoCat Bridge is a plugin for QGIS that can be used to publish geospatial (meta)data to the cloud.
Stars: ✭ 24 (-50%)
Mutual labels:  postgis
victor
Turn mapbox vector tiles into static maps in R
Stars: ✭ 28 (-41.67%)
Mutual labels:  vector-tiles
freemap-mapnik
Outdoor map mainly for https://www.freemap.sk/
Stars: ✭ 16 (-66.67%)
Mutual labels:  mapnik
kvwmap
Internet GIS Framework for MapServer with PHP
Stars: ✭ 19 (-60.42%)
Mutual labels:  postgis
DsgTools
DSG's QGIS Plugin for GIS production
Stars: ✭ 37 (-22.92%)
Mutual labels:  postgis
java-crud-api
No description or website provided.
Stars: ✭ 24 (-50%)
Mutual labels:  postgis
vector-tile-base
A very basic and low level library written in python for encoding and decoding Mapbox Vector Tiles
Stars: ✭ 42 (-12.5%)
Mutual labels:  vector-tiles
carto-workshop
CARTO training materials
Stars: ✭ 81 (+68.75%)
Mutual labels:  postgis
mybatis-typehandlers-postgis
MyBatis Type Handlers for PostGIS
Stars: ✭ 58 (+20.83%)
Mutual labels:  postgis
HMap
:earth: HMap | 基于openlayers的封装组件
Stars: ✭ 64 (+33.33%)
Mutual labels:  vector-tiles

tilelive-postgis

npm version npm downloads Build Status

Implements the tilelive API for generating mapnik vector tiles from PostGIS.

Installation

npm install @mapbox/tilelive tilelive-postgis

Usage

const tilelive = require('@mapbox/tilelive');
require('tilelive-postgis').registerProtocols(tilelive);

const uri = 'postgis://user:password@localhost:5432/test?table=test_table&geometry_field=geometry&srid=4326';
tilelive.load(uri, (error, source) => {
  if (error) throw error;

  source.getTile(0, 0, 0, (error, tile, headers) => {
    // `error` is an error object when generation failed, otherwise null.
    // `tile` contains the compressed image file as a Buffer
    // `headers` is a hash with HTTP headers for the image.
  });
});

If PostgreSQL server running locally and accepting connections on Unix domain socket, you can connect like this:

const uri = 'postgis:///var/run/postgresql/test?table=test&geometry_field=geom';
tilelive.load(uri, (error, source) => { ... });

You can also use query parameter to specify sub-query like this:

const query = `(select * from schemaName.tableName where st_intersects(geometry, !bbox!)) as query`;
const uri = `postgis://user@localhost/test?table=test_table&geometry_field=geometry&query=${encodeURI(query)}`;
tilelive.load(uri, (error, source) => { ... });

Parameters

The only parameter that is not mapnik specific is:

parameter value description default
layerName string name of the layer in resulting tiles. defaults to the table name for backwards compatibility.

Actual list of parameters you can see here.

parameter value description default
table string name of the table to fetch.
geometry_field string name of the geometry field, in case you have more than one in a single table. This field and the SRID will be deduced from the query in most cases, but may need to be manually specified in some cases.
geometry_table string name of the table containing the returned geometry; for determining RIDs with subselects
srid integer srid of the table, if this is > 0 then fetching data will avoid an extra database query for knowing the srid of the table 0
extent string maxextent of the geometries determined by querying the metadata for the table
extent_from_subquery boolean evaluate the extent of the subquery, this might be a performance issue false
connect_timeout integer timeout is seconds for the connection to take place 4
persist_connection boolean choose whether to share the same connection for subsequent queries true
row_limit integer max number of rows to return when querying data, 0 means no limit 0
cursor_size integer if this is > 0 then server cursor will be used, and will prefetch this number of features 0
initial_size integer initial size of the stateless connection pool 1
max_size integer max size of the stateless connection pool 10
multiple_geometries boolean whether to use multiple different objects or a single one when dealing with multi-objects (this is mainly related to how the label are used in the map, one label for a multi-polygon or one label for each polygon of a multi-polygon) false
encoding string internal file encoding utf-8
simplify_geometries boolean whether to automatically reduce input vertices. Only effective when output projection matches (or is similar to) input projection. Available from version 2.1.x up. false
max_async_connection integer max number of PostGIS queries for rendering one map in asynchronous mode. Default value (1) has no effect. 1
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].