GDAL

Overview

GDAL is a translator library for raster and vector geospatial data formats. As a library, it presents a single raster abstract data model and single vector abstract data model to the calling application for all supported formats. It also comes with a variety of useful command line utilities for data translation and processing.

Restrictions on use

There are no restrictions on access to the GDAL libraries on CSF. The software is released under a MIT/X-like license. All usage must adhere to this license.

Set up procedure

We now recommend loading modulefiles within your jobscript so that you have a full record of how the job was run. See the example jobscript below for how to do this. Alternatively, you may load modulefiles on the login node and let the job inherit these settings.

Load one of the following modulefiles to set up your environment:

module load libs/gcc/gdal/2.4.4               # Uses system default GCC 4.8.5 compiler.
                                              # Includes support for HDF5 1.8.21, NetCDF 4.6.2
                                              # and GEOS 3.8.0 (these modulefiles will be
                                              # loaded automatically)

module load libs/intel-18.0/gdal/2.4.4        # Use the Intel 18.0 compiler. Does NOT include
                                              # HDF5, NetCDF and GEOS support. It may provide
                                              # better performance than the gcc version.

Compiling an GDAL-capable application

You will mostly use the GDAL installation on CSF3 when compiling your own software. This allows you to add GDAL functionality to your own apps. There are some tools you can also run to process existing data files (see below).

The modulefiles will set an environment variable named ${GDALDIR} which can then be used in your compilation process (e.g., in a Makefile or directly on the command-line) to access the header and library files:

  • To inform the compiler of the header file directory use:
    gcc -I${GDALDIR}/include ....
  • To inform the compiler of the library files use:
    gcc ... -L${GDALDIR}/lib -lgdal
  • In a Makefile ensure you use ${GDALDIR} rather than $GDALDIR.
  • The gdal-config application will be added to your PATH environment variable – some applications may run this to determine where the GEOS files are installed.

An example compilation command could be

gcc -I${GDALDIR}/include example_gdal.c -o example_gdal -L${GDALDIR}/lib -lgdal

Running an GDAL-capable application

You must load the GDAL modulefile before running your GDAL-capable application (unless you have statically linked your code against the GDAL libraries).

Please do not run GDAL-capable applications on the login node. Jobs should be submitted to the compute nodes via batch.

Serial batch job submission

Create a batch submission script (which will load the modulefile in the jobscript), for example:

#!/bin/bash --login
#$ -cwd             # Job will run from the current directory
                    # NO -V line - we load modulefiles in the jobscript

# Load the serial (non-MPI) modulefile
module load libs/gcc/gdal/2.4.4

# Run my application I compiled earlier
./mygdalapp arg1 ...

Submit the jobscript using:

qsub scriptname

where scriptname is the name of your jobscript.

GDAL Tools

The GDAL bin directory is added to your path so that you can access the gdal... tools. Use ls ${GDALBIN} to see all binary tools:

# GDAL tools - must be used in batch jobs, as above
gdaladdo      gdalenhance       gdal_rasterize  gdal_translate  ogr2ogr
gdalbuildvrt  gdal_grid         gdalserver      gdalwarp        ogrinfo
gdal-config   gdalinfo          gdalsrsinfo     gnmanalyse      ogrlineref
gdal_contour  gdallocationinfo  gdaltindex      gnmmanage       ogrtindex
gdaldem       gdalmanage        gdaltransform   nearblack       testepsg

Further info

See the GDAL website for full documentation.

Updates

None.

Last modified on March 11, 2020 at 12:03 pm by George Leaver