<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, 9 Feb 2016 at 05:18 Worrall, James -FS <<a href="mailto:jworrall@fs.fed.us">jworrall@fs.fed.us</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="white" background="cid:image001.gif@01D16261.14D68D50" lang="EN-US" link="#9D454F" vlink="#814E95">
<img src="cid:152c44efb3d4cdccc1" alt="image001.gif" class="GQ" style="max-width: 100%;">
<div>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext">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?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext">I have a geodatabase that looks like this:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext"><u></u> <u></u></span></p>
<table border="0" cellspacing="0" cellpadding="0" width="933" style="width:699.75pt;background:white">
<tbody>
<tr>
<td valign="top" style="padding:0in 0in 6.0pt 4.5pt">
<p class="MsoNormal" style="word-break:break-all"><span style="font-size:10.0pt;font-family:"Lucida Console";color:blue">> ogrListLayers( "D:USvegNRIS.gdb" )
<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span style="font-size:10.0pt;font-family:"Lucida Console"">[1] "NRIS_VegCharacterizations" "NRIS_VegDisturbances" "NRIS_VegGisCalcs" "NRIS_VegPolyLinks"
<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span style="font-size:10.0pt;font-family:"Lucida Console"">[5] "NRIS_VegSubpopulations" "NRIS_VegPointLinks" "NRIS_VegLocations" "NRIS_VegPoint"
<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span style="font-size:10.0pt;font-family:"Lucida Console"">[9] "NRIS_VegPoly"
<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span style="font-size:10.0pt;font-family:"Lucida Console"">attr(,"driver")<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span style="font-size:10.0pt;font-family:"Lucida Console"">[1] "OpenFileGDB"<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span style="font-size:10.0pt;font-family:"Lucida Console"">attr(,"nlayers")<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span style="font-size:10.0pt;font-family:"Lucida Console"">[1] 9<u></u><u></u></span></p>
</td>
</tr>
<tr>
<td valign="top" style="padding:0in 0in 6.0pt 4.5pt"></td>
</tr>
<tr>
<td valign="top" style="padding:0in 0in 6.0pt 4.5pt">
<table border="0" cellspacing="0" cellpadding="0" width="933" style="width:699.75pt">
<tbody>
<tr>
<td width="1" valign="top" style="width:.75pt;padding:0in 0in 0in 0in"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext">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). <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext">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:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext">Error in readOGR(dsn = "USVEGNRIS.gdb", layer = "NRIS_VegSubpopulations") :
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext"> no features found<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext">In addition: Warning message:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext"> In ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, :<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext"> ogrInfo: all features NULL<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext">Can you think of a way to get at such data within R?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext"><u></u> </span></p></div></div></blockquote><div><br></div><div>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</div><div><br></div><div>ogr2ogr -f CSV output.csv <span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:18.6667px">USVEGNRIS.gdb </span><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:18.6667px">NRIS_VegSubpopulations</span></div><div><span style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:18.6667px"><br></span></div><div>There are better output formats obviously, but what works best will depend. </div><div><br></div><div>gdalUtils can be used to drive the command line tools. </div><div><br></div><div>Cheers, Mike. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="white" background="cid:image001.gif@01D16261.14D68D50" lang="EN-US" link="#9D454F" vlink="#814E95"><div><p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Calibri",sans-serif;color:windowtext"><u></u></span></p>
</div>
</div>
_______________________________________________<br>
R-sig-Geo mailing list<br>
<a href="mailto:R-sig-Geo@r-project.org" target="_blank">R-sig-Geo@r-project.org</a><br>
<a href="https://stat.ethz.ch/mailman/listinfo/r-sig-geo" rel="noreferrer" target="_blank">https://stat.ethz.ch/mailman/listinfo/r-sig-geo</a></blockquote></div></div><div dir="ltr">-- <br></div><div dir="ltr"><span>Dr. Michael Sumner</span><br><span>Software and Database Engineer</span><br><span>Australian Antarctic Division</span><br><span>203 Channel Highway</span><br><span>Kingston Tasmania 7050 Australia</span><br><br></div>