Koop PostGIS Vector Tiles
I introduced the Koop PostGIS provider from a developer perspective in a previous post where the output is GeoServices. This post will guide us through installing a Koop service with support for PostGIS input and Vector Tiles as an output format.
Update 09/12/2021
Replaced ArcGIS Oceans Basemap with Dark Gray Vector Basemap in the client javascript example.
Install
Koop providers require you to first install Koop. You can add koop-provider-pg
to your Koop server dependencies by installing it with npm:
1 | # install koop cli using npm |
This will allow you to serve your PostGIS data as GeoServices. You can add @koopjs/output-vector-tiles
to generate pbf
vector tiles as output:
1 | $ koop add output @koopjs/output-vector-tiles |
Start the Koop server
1 | # start koop server |
Vector Tiles
The server will now support both GeoServices and Vector Tiles as output formats to your PostGIS input data. Below is a list of the output routes for vector tiles:
1 | # :id = ${schema}.$(table) |
Your data can now be viewed in clients that support Vector Tiles. Below is an example using ArcGIS API for Javascript creating a VectorTileLayer class with the service URL to display the data. Replace ${schema}.${table}
with schema.table from your PostGIS db to view:
1 | require(["esri/Map", "esri/views/MapView", "esri/layers/VectorTileLayer"], function( |
Generating the following ouput of PostGIS point data over the Dark Gray Vector Basemap
You can view the example in the Koop PostGIS provider source.