library(sf)
## Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
The first step to read all the layers in the Shelby geodatabase (Shelby.gdb) file is to list the layers. The following code lists all the layers present in the Shelby.gdb.
dsn = "Data/Shelby.gdb"
Layers <- st_layers(dsn)
A for loop will read all layer names from the Layers object and plot the layers.
for(name in Layers$name){
Shelby <- st_read(dsn, layer=name)
#st_write(Shelby, name, driver = "ESRI Shapefile", delete_layer = TRUE)
plot(st_geometry(Shelby), main=name)
}
## Reading layer `Community_Garden_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 33 features and 17 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: 756844.4 ymin: 298726.4 xmax: 794158.8 ymax: 341723.2
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `School_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 391 features and 17 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: 734398 ymin: 263306.1 xmax: 876914 ymax: 397840.4
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `Rail_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 339 features and 8 fields
## geometry type: MULTILINESTRING
## dimension: XY
## bbox: xmin: 727063.6 ymin: 263436.6 xmax: 883773.4 ymax: 407636.1
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `Parks_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 226 features and 6 fields
## geometry type: GEOMETRY
## dimension: XY
## bbox: xmin: 732044.5 ymin: 265123.9 xmax: 878833.9 ymax: 410431.8
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `Library_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 22 features and 16 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: 752812.9 ymin: 272549.6 xmax: 875503.7 ymax: 390129.8
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `Law_Enforcement_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 37 features and 17 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: 752117.2 ymin: 278903.1 xmax: 872274.7 ymax: 390481
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `Hospital_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 21 features and 17 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: 760308.5 ymin: 279451.1 xmax: 856890.3 ymax: 351008.6
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `Health_Centers_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 31 features and 16 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: 757687.9 ymin: 277327.6 xmax: 872210.3 ymax: 391961
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `Grocer_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 60 features and 16 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: 755399 ymin: 271441.9 xmax: 875874.3 ymax: 401002.8
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `Fire_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 89 features and 17 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: 739899.8 ymin: 269570.5 xmax: 873174.7 ymax: 392902.6
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `Farmer_Market_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 14 features and 17 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: 754547.3 ymin: 279243.4 xmax: 875874.3 ymax: 390219.8
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `County_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 1 feature and 23 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: 677966.9 ymin: 261279.3 xmax: 885736.8 ymax: 412664.8
## projected CRS: NAD83 / Tennessee (ftUS)
## Reading layer `roads_shelby' from data source `C:\Rizwan\Education\UofM PhD Work\Seminar in Earth Sciences\R-Spatial\Data\Shelby.gdb' using driver `OpenFileGDB'
## Simple feature collection with 2763 features and 8 fields
## geometry type: MULTILINESTRING
## dimension: XY
## bbox: xmin: -90.12757 ymin: 34.99427 xmax: -89.6358 ymax: 35.40568
## geographic CRS: WGS 84