R-CMD-check codecov CRAN status cran checks


gdalraster is an R interface to the Raster API of the Geospatial Data Abstraction Library (GDAL). Calling signatures resemble those of the native C, C++ and Python APIs provided by the GDAL project.

Bindings to GDAL are implemented in the exposed C++ class GDALRaster along with several stand-alone functions, supporting:

Additional functionality includes:

gdalraster may be suitable for applications that primarily need low-level raster I/O or prefer a direct GDAL API. The additional functionality is somewhat aimed at thematic data analysis but may have other utility.


Install the released version from CRAN with:


CRAN provides pre-compiled binary packages for Windows and macOS. These do not require any separate installation of external libraries for GDAL and PROJ.

From source code


GDAL (>= 2.4.0, built against GEOS), PROJ (>= 4.8.0), and sqlite3 are required.

On Ubuntu, recent versions of geospatial libraries can be installed from the ubuntugis-unstable PPA with the following commands:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt install libgdal-dev libgeos-dev libproj-dev libsqlite3-dev

The releases in ubuntugis-unstable generally work well and are more up-to-date, but the less recent versions in ubuntugis-stable could be used instead.

Package sf provides helpful instructions for installing the geospatial libraries on other Linux distributions.

With system requirements met, install gdalraster from CRAN:


Or install the development version from GitHub using package remotes:



RTools is needed to install from source on Windows. RTools since version 4.2 includes GDAL, PROJ and all other dependent libraries that are needed to compile gdalraster. Note that CRAN releases periodic revisions to RTools that often include updates to the libraries as new versions become available. For example, the 5863 revision of RTools 4.3 contains GDAL 3.7.2 and PROJ 9.3.0.

With RTools installed:

# Install the development version from GitHub


GDAL and PROJ can be installed with Homebrew:

brew install pkg-config gdal proj

Then in R, configure.args is needed:

# Install the development version from GitHub
remotes::install_github("USDAForestService/gdalraster", configure.args = "--with-proj-lib=$(brew --prefix)/lib/")