In R, how do we get a file list of rasters in a geodatabase folder?

We know the case of vector layers as follow.

fgdb = "C:/path/to/your/filegeodatabase.gdb"
subset(ogrDrivers(), grepl("GDB", name))
fc_list = ogrListLayers(fgdb)

However, for raster layers, if only we know the raster layer name, we can read it by specifying the layer name as follow.

a <- as.raster(arc.raster(arc.open(paste(fgdb,"/rasterlayername", sep=""))))

For more effective reading, I want to get the raster layers name list like the vectors layers case. How to do it??

RasList <- arc.open(fgdb)@children$RasterDataset
a <- NULL
for(i in 1:length(RasList)){
a[[i]] <- as.raster(arc.raster(arc.open(paste(fgdb,"/",RasList[i], sep=""))))
  • This may have changed but, historically the ESRI filegeodatabase API did not support rasters. This is what GDAL uses so, it is likely that you cannot read rasters stored in this format. – Jeffrey Evans Sep 12 '19 at 15:40
  • Yes, currently a ESRI developer provides a reading tool for raster layers in the geodatabase. But, it seems to be nothing to get the layer names list in R ... . – Pavel Nedved Sep 13 '19 at 0:41
  • 1
    Oh, I may solve the problem. ``` RasList <- arc.open(fgdb)@children$RasterDataset ``` – Pavel Nedved Sep 13 '19 at 2:43
  • @PavelNedved, you may submit an answer to your own question if you like. – saQuist Jan 19 at 12:23

Your Answer

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

Browse other questions tagged or ask your own question.