TransWikia.com

Creating tile server with already created .png - tiles

Geographic Information Systems Asked by NicolasT on February 18, 2021

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?

One Answer

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

layer = new TileLayer({
    source: new XYZ({
      url:
        'https://www.example.com/path/to/tiles/{z}/{x}/{y}.png'
    });
})

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

Correct answer by bugmenot123 on February 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP