ReadyMap with TileServer GL
TileServer GL is an open source project from MapTiler that renders vector tiles using MapLibre GL (an open source fork of Mapbox GL). This guide shows you how you can deploy a service like TileServer GL alongside your ReadyMap server on the same hardware and how they can interact together.
We can start with a simple deployment of ReadyMap and add the tileserver-gl container along side it.
services:
# Database
db:
image: postgis/postgis:16-3.4-alpine
privileged: true
volumes:
- readymap_db:/var/lib/postgresql/data
restart: always
# Redis
redis:
image: redis:5.0-alpine
restart: always
# ReadyMap
readymap:
image: pelicanmapping/readymap:4.6.0
privileged: true
restart: always
volumes:
- /data:/data
- /tiles:/tiles
ports:
- "80:80"
environment:
- LICENSE_TEXT=XXX
depends_on:
- db
- redis
# Make tileservergl accessible to the ReadyMap container.
- tileservergl
# TileServer GL (Add this section)
tileservergl:
image: maptiler/tileserver-gl
ports:
# Expose tileservergl on port 8080.
# This is optional but allows you to view the TileServer GL
# interface if you'd like.
- "8080:8080"
volumes:
# /osm_data is where you place your TileServer GL configuration.
- /osm_data:/data
volumes:
# Database storage volume
readymap_db:
To get started with some sample data, go to your /osm_data directory and download some sample data for TileServer GL
cd /osm_data
wget https://github.com/maptiler/tileserver-gl/releases/download/v1.3.0/test_data.zip
unzip test_data.zip
Now, you can apply your changes to your docker-compose.yml and start your services.
You should be able to navigate to http://localhost:8080 and see TileServer GL running with data available around Zurich Switzerland.
Each style available in Tileserver GL is available as a raster service that is rendered on the fly to a PNG. We can cache these tiles and serve them from ReadyMap using the XYZ layer in ReadyMap.
For example, to proxy the klokan-basic style that comes with the test data you can follow these steps.
- From the Raster Layers page in ReadyMap click New Layer and choose XYZ.
- Name your layer whatever you would like.
- Select Spherical Mercator for the projection since that is the only projection that TileServer GL uses.
- Enter http://tileservergl:8080/styles/klokantech-basic/512/{z}/{x}/{-y}.png for the URL template.
Since we added tileservergl
to the depends_on
section of the ReadyMap container in the docker-compose.yml
file, the tileservergl
container is accessible from the ReadyMap container using the hostname tileservergl
. Any network traffic from the ReadyMap container to tileservergl
will be routed to the tileservergl
container.
You should now be able to access your new layer and see data being proxied from TileServer GL to ReadyMap.