Skip to content

Commit

Permalink
update aws endpoint, closes #92
Browse files Browse the repository at this point in the history
  • Loading branch information
jsta committed Aug 11, 2023
1 parent 9716508 commit 27aa9ec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## nhdR 0.6.1

* Update nhdplus download endpoint (#92)

## nhdR 0.6.0

* Dropped use of the retiring `rgdal` package (#91)
Expand Down
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ get_plus_remotepath <- function(vpu, component = "NHDSnapshot") {
}

baseurl <- paste0(
"https://edap-ow-data-commons.s3.amazonaws.com?delimiter=/&prefix=",
"https://dmap-data-commons-ow.s3.amazonaws.com?delimiter=/&prefix=",
prefix)
res <- read_xml(baseurl)
res <- stringr::str_extract_all(as.character(res),
Expand All @@ -100,7 +100,7 @@ get_plus_remotepath <- function(vpu, component = "NHDSnapshot") {
res <- res[!(seq_len(length(res)) %in%
c(grep("FGDB", res), grep(".pdf", res), grep("FileGDB", res)))]

paste0("https://edap-ow-data-commons.s3.amazonaws.com/", res[1])
paste0("https://dmap-data-commons-ow.s3.amazonaws.com/", res[1])
}

is_spatial <- function(filename) {
Expand Down
2 changes: 1 addition & 1 deletion data-raw/get-vpu-shp.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ library(rgdal)
library(nhdR)

# https://www.epa.gov/waterdata/nhdplus-global-data
remote_path <- "https://https://edap-ow-data-commons.s3.amazonaws.com/NHDPlusV21/Data/GlobalData/NHDPlusV21_NHDPlusGlobalData_03.7z"
remote_path <- "https://https://dmap-data-commons-ow.s3.amazonaws.com/NHDPlusV21/Data/GlobalData/NHDPlusV21_NHDPlusGlobalData_03.7z"
temp_dir <- tempdir()
in_path <- file.path(temp_dir, "nhdglobal.7z")
# in_path <- "/tmp/RtmpsyMbWy/nhdglobal.7z"
Expand Down
4 changes: 2 additions & 2 deletions data-raw/get-vpu_key.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ get_nhdplus_v21_links <- function(){
}

directory_raw <- read_xml(
"https://edap-ow-data-commons.s3.amazonaws.com?delimiter=/&prefix=NHDPlusV21/Data/")
"https://dmap-data-commons-ow.s3.amazonaws.com?delimiter=/&prefix=NHDPlusV21/Data/")

top_directories <- xml2::xml_text(directory_raw)
top_directories <- strsplit(top_directories, "NHDPlusV21")[[1]]
Expand All @@ -16,7 +16,7 @@ get_nhdplus_v21_links <- function(){

directories <- lapply(top_directories, function(x){
raw <- read_xml(paste0(
"https://edap-ow-data-commons.s3.amazonaws.com?delimiter=/&prefix=", x))
"https://dmap-data-commons-ow.s3.amazonaws.com?delimiter=/&prefix=", x))

if(has_sub_dirs(raw)){
res <- data.frame(
Expand Down

0 comments on commit 27aa9ec

Please sign in to comment.