Commit 464327a3 authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

Catching a wierd condition where a URL doesn't return the content-type

parent bdbeb444
......@@ -41,7 +41,12 @@ getWebServiceData <- function(obs_url, ...){
return(invisible(NULL))
} else {
headerInfo <- httr::headers(returnedList)
if(!"content-type" %in% names(headerInfo)){
message("Unknown content, returning NULL")
return(invisible(NULL))
}
if(headerInfo$`content-type` %in% c("text/tab-separated-values;charset=UTF-8")){
returnedDoc <- httr::content(returnedList, type="text",encoding = "UTF-8")
} else if (headerInfo$`content-type` %in%
......
......@@ -25,9 +25,9 @@
#' "observedProperty=urn:ogc:def:property:OGC:GroundWaterLevel",
#' "responseFormat=text/xml",
#' "featureOfInterest=VW_GWDP_GEOSERVER.USGS.403836085374401",sep="&")
#' if(!httr::http_error(obs_url)){
#' data_returned <- importNGWMN(obs_url)
#' }
#'
#' data_returned <- importNGWMN(obs_url)
#'
#' }
#'
importNGWMN <- function(input, asDateTime=FALSE, tz="UTC"){
......
......@@ -32,9 +32,9 @@ obs_url <- paste("https://cida.usgs.gov/ngwmn_cache/sos?request=GetObservation",
"observedProperty=urn:ogc:def:property:OGC:GroundWaterLevel",
"responseFormat=text/xml",
"featureOfInterest=VW_GWDP_GEOSERVER.USGS.403836085374401",sep="&")
if(!httr::http_error(obs_url)){
data_returned <- importNGWMN(obs_url)
}
data_returned <- importNGWMN(obs_url)
}
}
......@@ -27,6 +27,11 @@ parameterData data frame with the following information:
Imports data from NWIS about meaured parameter based on user-supplied parameter code or codes.
This function gets the data from here: \url{https://nwis.waterdata.usgs.gov/nwis/pmcodes}
}
\examples{
paramINFO <- readNWISpCode(c('01075','00060','00931'))
paramINFO <- readNWISpCode(c('01075','00060','00931', NA))
}
\seealso{
\code{\link{importRDB1}}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment