Once you have generated or downloaded vector tiles from the downloads you need a tileserver to serve the vector tiles via HTTP to your map clients or fall back to rendering raster tiles for users with legacy browsers.
Tileserver GL supports both serving vector tiles and raster tiles (through Mapbox GL Native) and also providing a WMTS endpoint. You can dive into the main documentation for Tileserver GL.
This tutorial will show you how to serve the downloaded vector tiles from OpenMapTiles.
We recommend to install Tileserver GL using Docker:
docker pull klokantech/tileserver-gl
Now download the vector tiles from OpenMapTiles.
curl -o zurich_switzerland.mbtiles https://openmaptiles.os.zhdk.cloud.switch.ch/v3.3/extracts/zurich_switzerland.mbtiles
Serve Map Tiles
You should mount the directory containing the vector tiles to the container
and bind the port
80 to a local port:
docker run -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl
This will start a Node.js container with tileserver-gl on your computer.
http://localhost:8080 to check the Tileserver GL GUI.
In the Data section of tileserver you will see your hosted vector tiles.
You can use the provided
TileJSON endpoint as source in your GL styles
or explore the data using the X-Ray view.
In the Styles section of the tileserver you will see the preconfigured styles to render raster tiles from the vector tiles in the Data section. You can check out the styles either using Leaflet and raster tiles (Raster) or Mapbox GL and vector tiles (Vector). You even get a WMTS endpoint for each of the tiles.
Read up on the main documentation for Tileserver GL for more advanced configurations or special needs.