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?
You can use rgdal to access feature classes in Esri file geodatabases.
require(rgdal) # 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) print(fc_list) # Read the feature class fc <- readOGR(dsn=fgdb,layer="some_featureclass") # Determine the FC extent, projection, and attribute information summary(fc) # View the feature class plot(fc)
As already posted in this answer, this now also works very nicely with
require(sf) fc <- sf::st_read("C:/path/to/your/filegeodatabase.gdb", layer = "some_featureclass")
st_drivers()$write[st_drivers()$long_name == "ESRI FileGDB"] #>  FALSE