Skip to content
Snippets Groups Projects
Commit a43e0885 authored by Bock, Andy's avatar Bock, Andy
Browse files

Wrote out RDS files for WBD and NHD HUC12

parent c4f00adc
No related branches found
No related tags found
1 merge request!31Bock
......@@ -256,10 +256,16 @@ if(!file.exists(nhdplus_dir)) {
suppressWarnings(staged_nhdplus <- stage_national_data())
rm(gLz, xWalk)
HUC12 <- readOGR(nhdplus_gdb, "HUC12") %>% st_as_sf() %>% st_transform(., crs = 5070)
saveRDS(HUC12, file = file.path(nhdplus_dir, "HUC12.rds"))
}
out_list <- c(out_list, list(nhdplus_dir = nhdplus_dir, nhdplus_gdb = nhdplus_gdb))
```
```{r NHDPlusV2 Waterbodies}
# Waterbodies - derived after downloading and post-processing NHDPlus Seamless National Geodatabase
......@@ -272,14 +278,14 @@ if(!file.exists(waterbodies_path)) {
# Read the feature class
fc <- readOGR(dsn = nhdplus_gdb, layer = "NHDWaterbody")
# Convert to simple feature
# Convert to simple feature and save out
wbSF <- st_as_sf(fc)
saveRDS(wbSF, waterbodies_path)
}
out_list <- c(out_list, list(waterbodies_path = waterbodies_path))
```
```{r NHDPlusV2 FDR_FAC}
# NHDPlus FDR/FAC grids available by raster processing unit
......@@ -287,7 +293,7 @@ fdr_fac_dir <- file.path(data_dir, "fdrfac")
dir.create(fdr_fac_dir, recursive = TRUE, showWarnings = FALSE)
# Will need to make this work for all the FdrFac data -- maybe just shell out to wget.
download_fdr_fac(fdr_fac_dir, regions = c(paste0("0", c(1:9)), paste0("1", c(1:8))))
download_fdr_fac(fdr_fac_dir)
dirs <- unique(dirname(list.files(fdr_fac_dir, recursive = TRUE, full.names = TRUE)))
fdr <- dirs[grepl(".*/fdr$", dirs)]
......@@ -312,10 +318,15 @@ if(!dir.exists(wbd_dir)) {
dir.create(wbd_dir, recursive = TRUE)
wbd <- download_wbd(wbd_dir, "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/WBD/National/GDB/WBD_National_GDB.zip")
}
}
# Read the feature class
wbdfc <- readOGR(dsn = file.path(wbd_dir, list.files(wbd_dir, pattern = "*.gdb")), layer = "WBDHU12") %>% st_as_sf() %>% st_transform(., crs = 5070)
saveRDS(wbdfc, file.path(wbd_dir, "WBD.rds"))
out_list <- c(out_list, latest_wbd = file.path(wbd_dir, list.files(wbd_dir, pattern = "*.gdb")))
```
```{r MERIT HydroDEM}
# MERIT HydroDEM - used for AK Geospatial Fabric, and potentially Mexico portion of R13
#-----------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment