I have a web application which shows a basic OSM card with OpenLayers.
Now I want to display radar data in form of a second layer where the user can view the radar data of the last 10 hours in 15 minutes intervalls. I already get the data via python and convert them to a .tif file.

Afterwards I use the QGIS python API to run the processing call "qgis:tilesxyzdirectory" which generates for each dataset my .png tiles.

As a result I have 40 folders (10 hours à 4 datasets) and all of them contain the rendered tiles from the specific time.

Now my next step would be serving those tiles to the webapp.

My initial thought was putting those tile images to a database and request the specific tiles manually via an API but now I found the concept of WMTS.

How can I add different different tile sets to the WMTS and provide the server as a tile server in OpenLayers?

1 Answer 1


You can simply host the tile directories with your webserver and reference them like this in OpenLayers:

layer = new TileLayer({
    source: new XYZ({

For a full example see https://openlayers.org/en/latest/examples/xyz.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.