Kartoza - Consuming Cloud Optimised GeoTIFFs in QGIS Server
QGIS has been able to consume cloud optimised GeoTIFFs (COGs) since v3.2, through the data source manager.
QGIS has been able to consume cloud optimised GeoTIFFs (COGs) since v3.2, through the data source manager. This article does not aim to explain what a COG is as various other articles have done so extensively.
Many organisations are choosing to use cloud based storage like S3 or Google Cloud Storage. Traditional GIS file formats can easily sit in the cloud, but serving up web map tiles or doing on-the-fly processing of the data are difficult to do efficiently with those formats. They often have to be fully downloaded to another location and then translated to an optimised format or stored in memory.
In this article I will describe the process of publishing a QGIS project with COG (in local storage) using QGIS Server. In future articles I will describe how the COG layer can be processed using QGIS Server algorithms to generate new data in an efficient way.
This is the docker-compose.yml file:
command: --provider local --basedir /data --temp-path /data
test: "exit 0"
I downloaded a DEM layer and followed the procedure from GDAL on how to generate a COG. Using docker-compose I started my containers by running
docker-compose up -d
After uploading my raster layer through the transfer interface I could access it from the URL
I then added this raster to QGIS using the datasource manager as depicted below.
I then proceeded to create a project in QGIS and configured it to be published by QGIS Server.
I opened the QGIS project in a text editor to change the URL from
http://transfer:8080since the QGIS project is to be consumed by QGIS Server in Docker and the two containers are linked. I then copied the QGIS project into the qgis container and I could connect to WMS services from QGIS using the following URL
The image below gives an illustration of how QGIS Server is accessing the HTTP GET range request .
In other set-ups like GeoTrellis they have built tools that allow users to process certain portions of the image and generate new data. This is very efficient as the whole tile is not loaded in memory or downloaded before processing is done.