[R-sig-Geo] Reading tables without geometry from gdb?
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Sun Feb 11 14:27:43 CET 2018
sf::st_read now returns a data.frame if no geometry column is found,
rather than raising an error:
https://github.com/r-spatial/sf/commit/77a31f2989a1d217438fb629ac34d7ef31baa9c2
it does emit a warning in that case, now, since an object of a different
type than expected is returned:
> x = st_read("fgdb.gdb",
"LandCover_Metrics_NYC_Community_Districts_Version10C")
Reading layer `LandCover_Metrics_NYC_Community_Districts_Version10C'
from data source `/tmp/fgdb.gdb' using driver `OpenFileGDB'
Warning message:
no simple feature geometries present: returning a data.frame
> x[1:2,]
TC_ID Total_A Can_A Grass_A Soil_A Water_A Build_A Road_A
Paved_A
1 1 41641392 4935664 3736731.7 21923.00 783819 13813225 8179456
10170573
2 2 37739955 4440133 632087.5 12255.75 343714 17140788 7380846
7790131
Perv_A Imperv_A Can_P Grass_P Soil_P Water_P Build_P Road_P
1 9478138 32163254 11.85278 8.973599 0.05264713 1.882307 33.17186 19.64261
2 5428190 32311765 11.76507 1.674850 0.03247420 0.910743 45.41815 19.55711
Paved_P Perv_P Imperv_P BoroCD
1 24.42419 22.76134 77.23866 101
2 20.64160 14.38314 85.61686 102
On 02/11/2018 05:22 AM, Michael Treglia wrote:
> Hi All,
>
> I have a file geodatabase with non-spatial tables that can be joined to
> other spatial objects. Is there a best/easiest way to import the
> non-spatial tables in R these days?
>
> I've seen some solutions here:
> https://gis.stackexchange.com/questions/184013/read-a-table-from-an-esri-file-geodatabase-gdb-using-r
> but figured I'd see if I'm missing anything within sf.
>
> If it helps, the dataset I'm looking at is here:
> https://data.cityofnewyork.us/Environment/NYC-Urban-Tree-Canopy-Assessment-Metrics-2010/hnxz-kkn5
>
> When I try sf::st_read, as follows, I get the subsequent error:
>> comdists_data <-
> sf::st_read(dsn=fgdb,table="LandCover_Metrics_NYC_Community_Districts_Version10C")
>
> Error in st_sf(x, ..., agr = agr, sf_column_name = sf_column_name) :
> no simple features geometry column present.
>
> Thanks all - best regards,
> Mike T
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48151 Muenster, Germany
Phone: +49 251 8333081
More information about the R-sig-Geo
mailing list