Skip to content

Opening non-spatial layer/feature class in gdb

2 messages · Worrall, James -FS, Michael Sumner

#
I've been playing with getting info on and opening geodatabases.  I was pleasantly surprised to find that rgdal could examine and open layers from them.  But I wonder if it can open non-spatial objects in them?  Or if there is any other R way to do that?

I have a geodatabase that looks like this:
[1] "NRIS_VegCharacterizations" "NRIS_VegDisturbances"      "NRIS_VegGisCalcs"          "NRIS_VegPolyLinks"
[5] "NRIS_VegSubpopulations"    "NRIS_VegPointLinks"        "NRIS_VegLocations"         "NRIS_VegPoint"
[9] "NRIS_VegPoly"
attr(,"driver")
[1] "OpenFileGDB"
attr(,"nlayers")
[1] 9




I can open NRIS_VegPoly as a SpatialPolygonsDataFrame with readOGR() (at least I can in another gdb with a similar layer, but this one is too enormous and R crashes).

But I am also interested in NRIS_VegSubpopulation.  This is simply a table, with multiple rows per polygon, with IDs linking them to polygons, but no spatial data.  Trying to open it doesn't work:

Error in readOGR(dsn = "USVEGNRIS.gdb", layer = "NRIS_VegSubpopulations") :
  no features found
In addition: Warning message:
  In ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  :
               ogrInfo: all features NULL

Can you think of a way to get at such data within R?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160208/8ea58267/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 92 bytes
Desc: image001.gif
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160208/8ea58267/attachment.gif>
#
On Tue, 9 Feb 2016 at 05:18 Worrall, James -FS <jworrall at fs.fed.us> wrote:

            
I don't think this is possible in R with readOGR. Pretty sure you can use
the GDAL command line tools to do  it though.  I would try something like

ogr2ogr -f CSV output.csv USVEGNRIS.gdb NRIS_VegSubpopulations

There are better output formats obviously, but what works best will depend.

gdalUtils can be used to drive the command line tools.

Cheers, Mike.