Skip to content

Commit

Permalink
Merge pull request #87 from vlahm/master
Browse files Browse the repository at this point in the history
updated nhdplus aws web location
  • Loading branch information
jsta authored Jul 28, 2022
2 parents e52cf9d + 4fb654e commit dbfef9c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 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://s3.amazonaws.com/edap-nhdplus?delimiter=/&prefix=",
"https://edap-ow-data-commons.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://s3.amazonaws.com/edap-nhdplus/", res[1])
paste0("https://edap-ow-data-commons.s3.amazonaws.com/", res[1])
}

is_spatial <- function(filename) {
Expand Down Expand Up @@ -394,4 +394,4 @@ st_line_sample_4326 <- function(lines) {
sf::st_transform(st_cast(
sf::st_line_sample(sf::st_transform(lines, 3395), sample = 0),
"POINT"), 4326)
}
}
4 changes: 2 additions & 2 deletions 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://s3.amazonaws.com/edap-nhdplus/NHDPlusV21/Data/GlobalData/NHDPlusV21_NHDPlusGlobalData_03.7z"
remote_path <- "https://https://edap-ow-data-commons.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 All @@ -23,4 +23,4 @@ vpu_shp <- sf::st_read(out_path)

vpu_shp <- nhdR:::make_valid_geom_s2(vpu_shp)

usethis::use_data(vpu_shp, overwrite = TRUE)
usethis::use_data(vpu_shp, overwrite = TRUE)
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://s3.amazonaws.com/edap-nhdplus?delimiter=/&prefix=NHDPlusV21/Data/")
"https://edap-ow-data-commons.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://s3.amazonaws.com/edap-nhdplus?delimiter=/&prefix=", x))
"https://edap-ow-data-commons.s3.amazonaws.com?delimiter=/&prefix=", x))

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

0 comments on commit dbfef9c

Please sign in to comment.