I have a feature contained in a geodatabase that is larger than 2GB as an exported shapefile. I need to run an extract function in R to attribute the polygons with data from a raster file. Exporting the feature as a table is not a solution. How can I read feature classes contained within an Esri file geodatabase?

2 Answers 2


You can use rgdal to access feature classes in Esri file geodatabases.


# The input file geodatabase
fgdb <- "C:/path/to/your/filegeodatabase.gdb"

# List all feature classes in a file geodatabase
subset(ogrDrivers(), grepl("GDB", name))
fc_list <- ogrListLayers(fgdb)

# Read the feature class
fc <- readOGR(dsn=fgdb,layer="some_featureclass")

# Determine the FC extent, projection, and attribute information

# View the feature class
  • 2
    Previously, you could only do this if you downloaded the ESRI filegeodatabase API and compiled GDAL against it. If you use OSGeo4W to install GDAL there is an option to do this automatically. However, this may have changed in later releases of GDAL and it could now be native so, if I am incorrect I apologize. Commented Jun 19, 2015 at 20:00
  • 3
    @JeffreyEvans This is native now.
    – Aaron
    Commented Jun 19, 2015 at 20:04
  • 4
    While it is native for windows, it does not seem to be included currently for other platforms (at least Debian Jessie). Commented Apr 4, 2016 at 3:21
  • 2
    +1 Works nicely. It helps to know that the layer argument may be omitted when there is just one feature class in the GDB.
    – whuber
    Commented May 8, 2018 at 20:29
  • 4
    For those who know nothing about gdb files, fgdb in this answer here is a directory and ogrListLayers() works on this directory... Commented Dec 7, 2018 at 8:26

As already posted in this answer, this now also works very nicely with sf:

fc <- sf::st_read("C:/path/to/your/filegeodatabase.gdb", layer = "some_featureclass")
But writing into a fgdb ist not implemented (yet?), you'd have to have a ArcGIS / ArcMap License as well as the R library `arcgisbinding` (see https://github.com/R-ArcGIS/r-bridge)

Writing to a fgdb is now implemented as well

st_drivers()$write[st_drivers()$long_name == "ESRI FileGDB"]
#> [1] TRUE
  • Writing is now implemented for gdal.org/drivers/vector/filegdb.html#vector-filegdb But, true to ESRI with the caveat: "The FileGDB SDK API does not allow to create a feature with a FID specified by the user. Starting with GDAL 2.1, the FileGDB driver implements a special FID remapping technique to enable the user to create features at the FID of their choice." Commented Jun 15, 2022 at 19:16

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.