initial 01_download_data.R
This commit is contained in:
parent
138a33b843
commit
5712066e81
@ -0,0 +1,30 @@
|
||||
# load libraries
|
||||
library(tidyverse)
|
||||
library(nhdplusTools)
|
||||
library(sf)
|
||||
|
||||
# load extent of map
|
||||
extent <- read.csv(file = "extent.csv")
|
||||
crs <- 26916
|
||||
|
||||
extent_poly <- st_polygon(
|
||||
x = list(
|
||||
cbind(
|
||||
extent$longitude[c(1,2,2,1,1)],
|
||||
extent$latitude[c(1,1,2,2,1)])
|
||||
)
|
||||
)
|
||||
|
||||
extent_poly <- st_sfc(extent_poly, crs=4326)
|
||||
|
||||
extent <- list(longitude_max = max(extent$longitude),
|
||||
longitude_min = min(extent$longitude),
|
||||
latitude_max = max(extent$latitude),
|
||||
latitude_min = min(extent$latitude))
|
||||
|
||||
|
||||
# get watershed areas
|
||||
extent_huc <- get_huc(AOI = extent_poly, buffer = 0, type = "huc04")
|
||||
|
||||
# download data
|
||||
download_nhdplushr("data", extent_huc$huc4, download_files = TRUE)
|
3
extent.csv
Normal file
3
extent.csv
Normal file
@ -0,0 +1,3 @@
|
||||
latitude,longitude
|
||||
43.63839,-89.97779
|
||||
42.52677,-88.52104
|
|
Loading…
x
Reference in New Issue
Block a user