[R-sig-Geo] Opening non-spatial layer/feature class in gdb
Michael Sumner
mdsumner at gmail.com
Tue Feb 9 05:42:26 CET 2016
On Tue, 9 Feb 2016 at 05:18 Worrall, James -FS <jworrall at fs.fed.us> wrote:
> [image: image001.gif]
>
> 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:
>
>
>
> > ogrListLayers( "D:USvegNRIS.gdb" )
>
> [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?
>
>
>
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.
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160209/2557588b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 92 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160209/2557588b/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 92 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160209/2557588b/attachment-0001.gif>
More information about the R-sig-Geo
mailing list