Once you have generated or downloaded vector tiles from the downloads you need a tile server 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 MBTiles file from the OpenMapTiles Downloads and save it in the actual directory.
curl -o zurich_switzerland.mbtiles https://[ADDRESS-YOU-GET-IN-DOWNLOADS]
Serve Map Tiles
You should mount the actual directory containing the vector tiles to the
/data path inside of the container
and bind the local port
8080 to port
80 inside container:
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 map 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.