We have recently been working for the French Space Agency ( CNES ) who needed to store and visualize satellite rasters in a cloud platform. They want to access the image raw data, with no transformation, in order to fullfill deep analysis like instrument calibration. Using classic cartographic server standard like WMS or TMS is not an option because those services transform datasets in already rendered tiles.
How it works
A COG file is a GEOTiff file which inner structure is tiled, meaning that the whole picture is divided in fixed size tile (256 x 256 pixels for instance) so you can efficiently retrieve parts of the raster. In addition to the HTTP/1.1 standard feature range request, it is possible to get specific tiles of an image through the network without downloading the entire raster.
We used a service provided by OpenStack, called Object Storage to serve the COG imagery. Object storage allows to store and retrieve file as objects using HTTP GET/POST requests.
Why not WCS ?
Web Coverage Service standard could have been an option. A WCS server can serve raw data according to a given geographic extent. It’s completely possible to deploy a container or a VPS (Virtual Private Server) running a WCS Server in a cloud plateform. The main advantages of the COG solution over WCS Server is that you don’t have to deal with the burden of deploying a server, like giving it ressources, configuring load balancing, handle updates, etc…
The beauty of COG solution is its simplicity. It is only HTTP requests, and everything else (rendering for instance) is done on the client side.
Step by step
Here are the different steps you’d have to go through if you’re willing to navigate in a big raster image directly from the cloud.
First, let’s generate a COG file
Install your openstack-client, it can be achieved easily with Python pip install command line
Next, configure your openstack client in order to generate an athentification token. To do so you need to download your project specific openrc file to setup your environment)
You are now good to push you COG file to the cloud instance
Before starting QGIS, 2 environment variables need to be set. (replace xxxx_my_token_xxxx with the token you’d just come to generate)
It can also be done directly from the QGIS Python console by setting those variable using the os.environ.
Finally, add a cloud raster data source in in QGIS
You can now navigating into your image directly reading it from the cloud
While panning in the map, QGIS will download only few tiles from the image in order to cover the view extent. The display latency that you could see in the video depends essentially on:
- The number of band of your image
- The pixel size
- Your internet connection (mine, the one use for the video, is not an awesome one)
Note that the white flickering that you could see when you move in the map and the raster is refreshed should be removed in next version of QGIS according to this QEP.
What’s next ?
Thanks so much to the GDAL and QGIS contributors for adding such a nice feature ! It brings lots of possibilities for organizations that have to deal with great number of big raster and just want to explore part of it.
We are already thinking about further improvments (ease authentification, better integration with processing…), so if you’re willing to fund them or just want to know more about QGIS, feel free to contact us at email@example.com. And please have a look at our support offering for QGIS.