maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.24k stars 639 forks source link

PostgreSQL as data source? #62

Closed abenrob closed 8 years ago

abenrob commented 8 years ago

Is it possible to use a non-mbtiles source for this server? I have global OSM data in a postgres database already, so referencing an mbtiles copy seems redundant storage-wise.

jingsam commented 8 years ago

tileserver-gl can not serve postgres directly. You should convert your datasets to vector tiles using tippecanoe or tilelive-bridge

petrsloup commented 8 years ago

You can also use https://github.com/terranodo/tegola to serve the vector tiles from PostGIS. You can then use the tiles in the JSON style (and possibly add other sources) to have both vector and raster tiles.

klokan commented 8 years ago

The complete answer is:

Yes, you can use in the TileServer GL non-mbtiles source. It is done via including http:// link to vector tiles source provided by an external service.

You may have vector tiles simply stored in Amazon S3 / Google Cloud Storage / unpacked directory on static hosting - like http://klokantech.github.io/mapbox-gl-js-offline-example/ or https://github.com/klokantech/vector-tiles-sample#host-the-vector-tiles-without-any-server-at-all

There are also other servers such as GeoServer or MapServer or Tegola - which are able to create on demand .pbf vector tiles in MVT (MapBox Vector Tiles) format from your Postgres database.

TileServer GL can then use such vector tile server and render these into raster tiles with defined JSON styles.

abenrob commented 8 years ago

Thanks @klokan ! That is exactly what I was looking for!