Closed dmpeterson2 closed 3 months ago
Hi there -- thanks for the reprex and thorough description. I think I see what's wrong.
download_dir <- download_nhdplushr(temp_dir, hu, download_files = FALSE)
with download_files=FALSE
returns the URL for the file you want rather than the path to the files you downloaded in your first step.
You'll need to pass temp_dir
or another file path to the files you want to open for it to work.
@dmpeterson2 free free to reopen this issue if my response wasn't the solution.
Hi! I am trying to build a function for calculating stream-distance between two points, part of which will read in a HUC4 watershed (defined in previous steps as a linestring, the
hu
object below). However, I will be working across a large portion of the US, and need to function to pull from previously-downloaded data (rather than downloading each iteration) in order to save time and memory.I have tried both downloading the zipped files from the National Map Downloader (and saving to a separate folder in my working directory) and using the
download_nhdplushr()
function to manually download relevant HUC4 flowlines (below), but it still cannot pull the correct file in the final step.results in output folders
which contain the proper files. However, when I try to define a HUC4 of interest and only read in that watershed:
results in output and errors:
Additionally, I've tried playing with it so that the
download_dir
object is all the watersheds I need to download (the first step), butget_nhdplushr()
is then unable to distinguish which HUC4 to pull, and pulls all three in thetemp_dir
. I figure it's likely an issue with directories and filepaths, but I just haven't been able to get it to work on my end. Thanks!