How can I import a raster file from a gdb into R?

Name of raster file: Cont_maturite in gdb : CAROPER_04151.gdb

In wd: c:\test\caroper

  • 3
    I doubt you can. Rasters are not supported by the file geodatabase API, so only Esri clients can access rasters in file geodatabases. – Vince Jan 7 '18 at 16:49

R spatial packages all depend on GDAL for file read/write, and GDAL uses the OpenFileGDB driver, which can only read vector data sources at this time - see https://www.gdal.org/drv_openfilegdb.html. The driver provides no write access at all.

If you have a recent version of ArcMap (>=10.3.1) or ArcGis Pro (1.1) installed, you can use the R package arcgisbinding to connect to ESRI proprietary data sources. This allows read/write access to anything in a File Geodatabase, plus SDE connections, as well as conversion from ESRI's own take on R spatial objects to and from sf, sp, and raster style objects. See https://github.com/R-ArcGIS/r-bridge.

  • 2
    This took me longer than it needed to. library(arcgisbindings); arc.check_product(); raster <- as.raster(arc.raster(arc.open("path/to/geodatabase.gdb/rasterlayername"))) – Ratnanil Mar 28 '19 at 11:32
  • You will need to install arcgisbinding from github. Download it at github.com/R-ArcGIS/r-bridge/releases/tag/v1.0.1.232. Do not unzip - save it in a folder, then install the package in Rstudio using the menu "Tools", "Install packages", and choose the downloaded package archive you just saved. Go to @obrl_soil's second link to install in arc. – Nova Aug 7 '19 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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