Cannot open data source. .GDB in R

我怕爱的太早我们不能终老 提交于 2021-01-29 09:57:07

问题


I am trying to load the data from the National Address Database provided by Transportation.gov into R. The data can be downloaded by anyone after accepting the disclaimer at this link: https://www.transportation.gov/gis/nad/disclaimer

I download the data, unzipped it into a directory I called data and then tried to use rgdal to list all the layers present in the data via:

fc_list<- rgdal::ogrListLayers("./data/NAD_20180215.gdb").

However, I cannot get rgdal to return anything other than an error saying "Cannot Open Data Source"....

I am wondering how I would go about listing the layers present in the .gdb folder as well as reading them into R?

I'm very grateful for any help. Thank you in advance.

-nate


回答1:


Following the suggestion here, using a full path to the gdb folder helped in my case.

# check for package and install if needed
if(!require(rgdal)){
    install.packages("rgdal", dep=T)
    library(rgdal)
}

# full path to the geodatabase required
fgdb <- "C:/full/path/to/the/geodatabase.gdb"

# list all feature classes in a file geodatabase
subset(ogrDrivers(), grepl("GDB", name))
ogrListLayers(fgdb)


来源:https://stackoverflow.com/questions/52340442/cannot-open-data-source-gdb-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!