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

added functions to download NID/TE points

parent e00f630f
No related branches found
No related tags found
1 merge request!13New Data sources, VPU subsetting, start of POI merge
......@@ -19,8 +19,6 @@ out_list <- list("data_dir" = data_dir)
out_file <- file.path("cache", "data_paths.json")
```
```{r}
hu12_points_path <- file.path(data_dir, "hu_points.gpkg")
......@@ -35,6 +33,7 @@ if(!file.exists(hu12_points_path)) {
out_list <- c(out_list, list(hu12_points_path = hu12_points_path))
```
```{r}
gagesiii_points_path <- file.path(data_dir, "GAGESIII_gages")
......@@ -79,6 +78,24 @@ if(!file.exists(TE_points_path)) {
out_list <- c(out_list, list(TE_points_path = TE_points_path))
```
```{r}
NID_points_path <- file.path(data_dir, "NID_points")
if(!file.exists(NID_points_path)) {
dir.create(NID_points_path, recursive = TRUE, showWarnings = FALSE)
if(is.null(sbtools::current_session()))
authenticate_sb()
NIDtxt <- "NID_attributes_20170612.txt"
sbtools::item_file_download("5dbc53d4e4b06957974eddae", names = NIDtxt,
destinations = file.path(NID_points_path, NIDtxt))
}
out_list <- c(out_list, list(NID_points_path = NID_points_path))
```
```{r}
nhdplus_dir <- file.path(data_dir, "NHDPlusNationalData")
nhdplus_gdb <- file.path(data_dir, "NHDPlusNationalData/NHDPlusV21_National_Seamless_Flattened_Lower48.gdb")
......@@ -86,11 +103,20 @@ nhdplus_gdb <- file.path(data_dir, "NHDPlusNationalData/NHDPlusV21_National_Seam
if(!file.exists(nhdplus_dir)) {
message("downloading NHDPlus...")
suppressMessages(nhdplus_gdb <- download_nhdplusv2(data_dir))
suppressMessages(nhdplus_gdb <- download_nhdplusv2(data_dir))
nhdplus_path(nhdplus_gdb)
nhdplus_path(nhdplus_gdb)
suppressWarnings(staged_nhdplus <- stage_national_data())
suppressWarnings(staged_nhdplus <- stage_national_data())
gLz <- "NHDPlusV21_NationalData_GageLoc_05.7z"
sbtools::item_file_download("5dbc53d4e4b06957974eddae", names = gLz,
destinations = file.path(nhdplus_dir, gLz))
unzip(file.path(nhdplus_dir, gLz), exdir = nhdplus_dir)
}
out_list <- c(out_list, list(nhdplus_dir = nhdplus_dir, nhdplus_gdb = nhdplus_gdb))
......
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