Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
podcast
Filter by Categories
ArcGIS Pro
GDAL
Map
Python
QGIS
Uncategorized

How to check your GDAL version

Navigating the GDAL Landscape: Understanding Versions and Compatibility

In the rapidly evolving world of geospatial data processing, the Geospatial Data Abstraction Library (GDAL) has remained a consistent and invaluable tool. However, with its vast functionality comes a multitude of versions and configurations, each carrying its own set of features, compatibilities, and potential challenges. This can sometimes be daunting for both newcomers and seasoned professionals alike.

In this blog post, we delve into the heart of GDAL, unraveling its versions and understanding how to check, install, or upgrade them across various platforms such as Python, QGIS, and PostGIS. We’ll tackle common questions around GDAL versioning, from understanding compatibility issues to dealing with version conflicts in your projects.

Want to stay ahead of the geospatial curve? listen to our podcast!

How to check your GDAL version

You can check the version of GDAL (Geospatial Data Abstraction Library) installed on your system via the command line. Here’s how to do it:

  • Open a command line window (like Terminal on MacOS or Command Prompt on Windows).
  • Type in the following command and press Enter:
gdalinfo --version

This command will output the version of GDAL that is currently installed on your system. It will look something like this:

GDAL 3.1.3, released 2020/09/01

In this example, the installed GDAL version is 3.1.3.

Please make sure GDAL is correctly installed and included in your system’s PATH to run the command successfully.

How to check your GDAL version in QGIS

To check the version of GDAL that QGIS is using, you can do the following:

  1. Open QGIS.
  2. Go to the menu and select “Help” -> “About”.
  3. In the About window, click on the “Libraries” tab.

The GDAL version will be listed there. This will be the version of GDAL that QGIS is currently using.

Please note that this is the general process and it might slightly vary depending on the version of QGIS you are using.

How to check your GDAL version in PostGIS

If you have PostGIS installed and want to check the GDAL version, you can do this by running a SQL command inside your PostGIS database.

Here is the command:

SELECT PostGIS_GDAL_Version();

This command will return the GDAL version that your PostGIS is using.

To run this command, you will need to connect to your database using a tool like psql (PostgreSQL interactive terminal), PgAdmin, or DBeaver.

For example, if you’re using psql, the steps are:

  1. Open a terminal or command prompt.
  2. Connect to your database with the command: psql -h hostname -d databasename -U username. You’ll be prompted to enter your password.
  3. Once you’re connected, run the SQL command above.

Please replace “hostname”, “databasename”, and “username” with your actual PostgreSQL host, database name, and username.

Keep in mind that this is a general approach and your specific setup might need a slightly different process.

How to check your GDALl version using python

You can use the gdal module in Python to check the version of GDAL. Here’s how to do it:

from osgeo import gdal

print(gdal.__version__)

This script will print the version of GDAL.

Please ensure that the gdal Python package is installed.

from osgeo import gdal

print(gdal.VersionInfo())

How to install a specific version of GDAL?

How to install a specific version of GDAL using the osgeo4w installer

The osgeo4w installer provides a simple and flexible way to install different versions of GDAL and other related libraries on Windows. Here are the general steps:

  1. Download the osgeo4w installer from the official website: https://trac.osgeo.org/osgeo4w/
  2. Run the installer. You will have two options: Express Desktop Install and Advanced Install. Choose “Advanced Install”.
  3. Follow the prompts. When you get to the “Select Packages” stage, you will see a list of categories. Expand the “Libs” category.
  4. Find the gdal package. Click on the version number next to it. Each click will cycle through available versions. Select the version you want.
  5. Continue through the installer and confirm the installation. The installer will download and install the selected version of GDAL along with any required dependencies.

Remember to set your PATH environment variable to include the osgeo4w bin directory, which is where the GDAL executables will be installed. This is typically C:\OSGeo4W64\bin. This will allow you to use the GDAL commands from the command line.

Also, if you want to use this version of GDAL in Python, you need to make sure that Python is also installed via osgeo4w, and that you’re using the Python executable that comes with osgeo4w. This will ensure that the GDAL Python bindings can find the GDAL libraries they need to work with.

How to install a specific version of GDAL using pip

To install a specific version of GDAL using pip, you can specify the version number. Here is an example where we install GDAL version 3.0.4:

pip install gdal==3.0.4

How to install a specific version of GDAL on Ubuntu

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install gdal-bin=3.0.4+dfsg-1~bionic0 libgdal-dev=3.0.4+dfsg-1~bionic0

How to set the PATH for GDAL in different versions?

The process of setting the PATH for GDAL is generally the same for all versions. Here’s how you do it on different operating systems:

On Linux/MacOS:

You can add the following line to your .bashrc or .bash_profile file (replace /path/to/gdal with the actual path):

export PATH=$PATH:/path/to/gdal

On Windows:

You can add GDAL to the PATH through the system properties:

  1. Right-click on Computer and click on Properties.
  2. Click on Advanced system settings.
  3. Click on Environment Variables.
  4. Under System variables, scroll down to find the Variable named Path.
  5. Click on Path and then click on Edit.
  6. In the Variable value field, scroll to the end and add the path to your GDAL installation preceded by a semicolon (;). For example, ;C:\Program Files\GDAL.

Compatibility issues with different versions of GDAL

There can be compatibility issues between different versions of GDAL. This is particularly relevant when working with different libraries or tools that rely on GDAL. For example, certain versions of libraries like rasterio, fiona, or geopandas might require specific versions of GDAL.

Similarly, if you’re using GDAL with applications like QGIS or PostGIS, they may require or be tested with certain versions of GDAL. Using a different version might result in unexpected behaviors or errors.

Different versions of GDAL might handle certain file formats or operations slightly differently, leading to differences in output.

Therefore, it’s important to check the documentation of any libraries or tools you’re using with GDAL to ensure compatibility with your GDAL version. If you’re encountering issues, it might be necessary to install a different version of GDAL that is known to work with your specific setup.

About the Author
I'm Daniel O'Donohue, the voice and creator behind The MapScaping Podcast ( A podcast for the geospatial community ). With a professional background as a geospatial specialist, I've spent years harnessing the power of spatial to unravel the complexities of our world, one layer at a time.

Leave a Reply