added layers variable to 2nd script

This commit is contained in:
Ben Varick 2023-10-16 16:46:49 -05:00
parent 87e087a5a7
commit 9cf982c483

View File

@ -1,4 +1,5 @@
# load libraries # load libraries
library(nhdplusTools)
library(sf) library(sf)
# reload extent data so you don't need to run the download data script again # reload extent data so you don't need to run the download data script again
@ -26,6 +27,10 @@ extent <- list(longitude_max = max(extent$longitude),
# load and crop hydrologic data # load and crop hydrologic data
data <- list(NULL) data <- list(NULL)
sf_use_s2(FALSE) sf_use_s2(FALSE)
layers <- c("NHDArea",
"NHDFlowline",
"NHDWaterbody",
"NHDPlusLandSea")
for (layer in layers){ for (layer in layers){
data[[layer]] <- st_crop(st_read(paste0(nhdplusTools_data_dir(),"/data.gpkg"), layer = layer), y = extent_bbox) data[[layer]] <- st_crop(st_read(paste0(nhdplusTools_data_dir(),"/data.gpkg"), layer = layer), y = extent_bbox)
} }