U.S. flag

An official website of the United States government

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Untitled Document
Astrogeology Analysis Ready Data
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage
Edit page

Setting QGIS Environment Variables for Performant Streaming

This is a work in progress. Please feel free to test, but use with caution!

In this tutorial, you will learn how to:

  • set QGIS environment variables for performant data streaming

This tutorial describes how to setup QGIS for faster data streaming from remote resources. This tutorial has drawn heavily from the terrific work done by the TiTiler team and their dynamic tiler performance tuning guide .

Prerequisites

This tutorial requires that you have the following tools installed on your computer:

Software Library or Application Version Used
QGIS 3.30.1

1. QGIS Setup

First, launch QGIS and open Settings -> Options dialog.

A PNG showing general settings dialog.

The *General* settings page visible when opening the *Options* dialog.

Next select System on the left side of the Options dialog. Scroll to the Environment section. To add an environment variable, click the large green plus sign. For each, variable added, set the Apply to Overwrite. The table below shows the variables to be set.

Variable Value Rationale
CPL_VSIL_CURL_ALLOWED_EXTENSIONS .tif,.TIF,.tiff Attempt to read only TIF files remotely using VSI. This limits the scanning done by QGIS for other file types.
GDAL_CACHEMAX 200 Sets the cache for GDAL to be 200MB. (Optionally increase the size further).
CPL_VSIL_CURL_CACHE_SIZE 200000000 Sets the VSI cache to be 200MB. (Optionally increase the size further).
GDAL_BAND_BLOCK_CACHE HASHSET See here
GDAL_DISABLE_READDIR_ON_OPEN EMPTY_DIR Very important to reduce the number of get requests on the remote resources.
GDAL_HTTP_MERGE_CONSECUTIVE_RANGES YES Tells GDAL to merge consecutive GET requests.
GDAL_HTTP_MULTIPLEX YES Improved performance if files are proxied through cloudfront.
GDAL_HTTP_VERSION 2 Improved performance if files are proxied through cloudfront.
VSI_CACHE TRUE Enable VSI caching
VSI_CACHE_SIZE 5000000 Increase the VSI cache size
A PNG showing environment variables filled in.

The *Environment* section of the *Options* dialog showing some of the above environment variables populated.

Once each of these environment variables has been added, restart QGIS.

Conclusion

That’s it! Your QGIS application is now setup for more efficient use of remote resources. If you have questions or comments consider chatting below.

Discuss this Tutorial


Disclaimers

Any use of trade, firm, or product names is for descriptive purposes only and does not imply endorsement by the U.S. Government.