2

I would like to open a .gdb file which I received as .tar.gdb. The unzipped folder contains the following elements in the figure. How can I open this in R? It is a raster digital elevation model. I need the elevation values of the raster cells but do not have ArcGIS or related programs on my computer 1.

1
  • 1
    There isn't any convention for passing file geodatabase as .tar.gdb, but it seems to have extracted correctly (FGDB is not a file format, but a directory of file contents, as opposed to RDBMS tables). That's the good news. The bad news is that rasters are not directly supported by either the Esri or Open file geodatabase drivers. There may be some reverse-engineered extraction tools but you'd probably be better off with alternate input.
    – Vince
    Commented May 1, 2020 at 12:06

2 Answers 2

3

gdb files are ESRI GeoDatabase files, a proprietary format not suited for exchange with other applications.

Versions of GDAL before 3.7 have no GDAL raster driver for ESRI GeoDatabase files, and since R uses GDAL to load raster data, this won't work. If you have GDAL version 3.7 or more you should have the driver. This version was released in May 2023 but its possible your version is old. Even the latest rocker/geospatial:latest docker image is currently only linked with GDAL 3.4.1.

4
  • 2
    File geodatabase hasn't changed format since the 9.3-10.0 reorganization to XML metadata. The read/write Esri FGDB API does not support pre-10 layout, but the read-only open API does. Neither supports rasters.
    – Vince
    Commented May 1, 2020 at 12:22
  • Very outdated answer. QGIS can open .gdb files directly now, so it should be possible in R too!
    – Tomas
    Commented Mar 17 at 22:34
  • @Tomas Really? What version of QGIS? Because the latest Ubuntu on my system only has GDAL 3.4.1 and that can't read rasters from an ESRI gdb. Perhaps you have >= 3.7
    – Spacedman
    Commented Mar 19 at 15:12
  • @Spacedman QGIS 3.16.4-Hannover, Compiled against GDAL/OGR 3.1.4.
    – Tomas
    Commented Jul 2 at 7:02
1

As an update to @Spacedman's answer regarding vector files, the terra::vect function makes reading .gdb files very easy for these filetypes:

DATA <- vect("/Path/File.gdb")

If the .gdb has multiple layers, there is also a layer argument to specify which one you want. Otherwise it just defaults to the first layer alphabetically.

SO Questions related to the OP's issue: Importing raster with R from File Geodatabase? and How to extract raster from .gdb instead of empty polygons?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.