1

I am trying to read a table from an ESRI geodatabase (.gdb) that has no geometry using R. readOGR is throwing an error because there is no geometry defined, which kind of make sense:

 # Load module to get readOGR
 require('rgdal');

 # Load module to get read.dbf
 require('foreign');

Le chargement a nécessité le package : foreign

# goto the directory with the GDB files
fgdb <- "c:/Mrnmicro/VulnerabilitePeuplements/gdb/Produits_IEQM_04151.gdb"

# List all feature classes in a file geodatabase
subset(ogrDrivers(), grepl("GDB", name))
      name    long_name write  copy isVector
34 OpenFileGDB ESRI FileGDB FALSE FALSE     TRUE
ogrListLayers(fgdb)
 [1] "ESSENCE_MAJ" "ETAGE_MAJ"   "Perimetre"   "PEE_MAJ"     "META_MAJ"   
attr(,"driver")
[1] "OpenFileGDB"
attr(,"nlayers")
[1] 5

 # Read the feature class
 fc = readOGR(dsn=fgdb,layer="ESSENCE_MAJ",dropNULLGeometries=FALSE)

Error in readOGR(dsn = fgdb, layer = "ESSENCE_MAJ", dropNULLGeometries =             FALSE) : 
  no features found
In addition: Warning message:
In ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv =     use_iconv,  :
  ogrInfo: all features NULL

----------

The same code with another layer (that is a shapefile) like PEE_MAJ works.

 fc = readOGR(dsn=fgdb,layer="PEE_MAJ",dropNULLGeometries=FALSE)
OGR data source with driver: OpenFileGDB 
Source: "c:/Mrnmicro/VulnerabilitePeuplements/gdb/Produits_IEQM_04151.gdb",     layer: "PEE_MAJ"
with 135202 features
It has 31 fields

Could you please help me to read features contained in the ESSENCE_MAJ table ?

1
  • Did you get this resolved? I am trying to find out how to read a zipped GDB file. Commented Oct 9, 2020 at 15:18

1 Answer 1

1

I had the same problem. My current solution is to directly call the OGR library from R and dump the content of the table into a csv that I read back in R:

system("ogr2ogr -f CSV ESSENCE_MAJ.csv Produits_IEQM_04151.gdb ESSENCE_MAJ")

See here for more info. It was on a unix machine, not quite sure about the exact command to call ogr2ogr on Windows. Hope it helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.