Commit 1f6d8d01 authored by David Watkins's avatar David Watkins
Browse files

big requests working on test

parent 246811f0
......@@ -46,4 +46,4 @@ VignetteBuilder: knitr
BuildVignettes: true
BugReports: https://github.com/USGS-R/dataRetrieval/issues
URL: https://github.com/USGS-R/dataRetrieval, http://pubs.usgs.gov/tm/04/a10/
RoxygenNote: 5.0.1
RoxygenNote: 6.0.1
......@@ -49,9 +49,9 @@ readNGWMNdata <- function(..., service = "observation", asDateTime = TRUE, tz =
dots <- list(...)
if(service == "observation"){
allObs <- NULL
allAttrs <- NULL
allSites <- NULL
allObs <- data.frame()
allAttrs <- data.frame()
#these attributes are pulled out and saved when doing binds to be reattached
attrs <- c("url","gml:identifier","generationDate","responsibleParty", "contact")
featureID <- na.omit(gsub(":",".",dots[['featureID']]))
......@@ -62,26 +62,22 @@ readNGWMNdata <- function(..., service = "observation", asDateTime = TRUE, tz =
#TODO: call featureOfInterest outside loop
for(f in featureID){
obsFID <- retrieveObservation(featureID = f, asDateTime, attrs)
siteFID <- retrieveFeatureOfInterest(featureID = f, asDateTime)
if(is.null(allObs)){
allObs <- obsFID
allAttrs <- saveAttrs(attrs, allObs)
allSites <- bind_cols(siteFID,allAttrs)
}else{
obsFIDatt <- saveAttrs(attrs, obsFID)
obsFID <- removeAttrs(attrs, obsFID)
allObs <- bind_rows(allObs, obsFID)
obsSites <- bind_cols(siteFID, obsFIDatt)
allSites <- bind_rows(allSites, obsSites)
}
obsFIDattr <- saveAttrs(attrs, obsFID)
obsFID <- removeAttrs(attrs, obsFID)
allObs <- bind_rows(allObs, obsFID)
allAttrs <- bind_rows(allAttrs, obsFIDattr)
attr(allObs, "siteInfo") <- allSites
returnData <- allObs
}
allSites <- retrieveFeatureOfInterest(featureID = featureID)
attr(allObs, "siteInfo") <- allSites
attr(allObs, "other") <- allAttrs
returnData <- allObs
}else if(service == "featureOfInterest"){
if("featureID" %in% names(dots)){
featureID <- na.omit(gsub(":",".",dots[['featureID']]))
#TODO: can do multi site calls with encoded comma
allSites <- retrieveFeatureOfInterest(featureID = dots[['featureID']], asDateTime=asDateTime)
allSites <- retrieveFeatureOfInterest(featureID = featureID)
}
if("bbox" %in% names(dots)){
allSites <- retrieveFeatureOfInterest(bbox=dots[['bbox']])
......@@ -163,7 +159,7 @@ readNGWMNsites <- function(featureID){
retrieveObservation <- function(featureID, asDateTime, attrs){
#will need to contruct this more piece by piece if other versions, properties are added
baseURL <- "http://cida-test.er.usgs.gov/ngwmn_cache/sos?request=GetObservation&service=SOS&version=2.0.0&observedProperty=urn:ogc:def:property:OGC:GroundWaterLevel&responseFormat=text/xml&featureOfInterest=VW_GWDP_GEOSERVER."
baseURL <- "https://cida-test.er.usgs.gov/ngwmn_cache/sos?request=GetObservation&service=SOS&version=2.0.0&observedProperty=urn:ogc:def:property:OGC:GroundWaterLevel&responseFormat=text/xml&featureOfInterest=VW_GWDP_GEOSERVER."
url <- paste0(baseURL, featureID)
returnData <- importNGWMN_wml2(url, asDateTime)
......@@ -193,7 +189,7 @@ retrieveObservation <- function(featureID, asDateTime, attrs){
#TODO: can do multisite calls
#TODO: allow pass through srsName needs to be worked in higher-up in dots
retrieveFeatureOfInterest <- function(..., asDateTime, srsName="urn:ogc:def:crs:EPSG::4269"){
baseURL <- "http://cida-test.usgs.gov/ngwmn_cache/sos?request=GetFeatureOfInterest&service=SOS&version=2.0.0"
baseURL <- "https://cida-test.er.usgs.gov/ngwmn_cache/sos?request=GetFeatureOfInterest&service=SOS&version=2.0.0"
dots <- list(...)
values <- convertDots(dots)
......
......@@ -22,4 +22,3 @@ values <- list(startDateLo="01-01-2002", characteristicName="Phosphorous",
values <- checkWQPdates(values)
}
\keyword{internal}
......@@ -76,4 +76,3 @@ urlQW <- constructNWISURL("450456092225801","70300",startDate="",endDate="","qw"
\keyword{import}
\keyword{service}
\keyword{web}
......@@ -25,4 +25,3 @@ Reconstructs URLs to retrieve data from here: \url{http://waterdata.usgs.gov/nwi
url <- constructUseURL(years=c(1990,1995),stateCd="Ohio",countyCd = c(1,3), categories = "ALL")
}
......@@ -41,4 +41,3 @@ url_wqp <- constructWQPURL(paste("USGS",siteNumber,sep="-"),
\keyword{import}
\keyword{service}
\keyword{web}
......@@ -25,4 +25,3 @@ head(countyCd)
}
\keyword{USGS}
\keyword{countyCd}
......@@ -23,4 +23,3 @@ name <- countyCdLookup(state = "OH", county = 13, output = "fullName")
index <- countyCdLookup(state = "Pennsylvania", county = "ALLEGHENY COUNTY", output = "tableIndex")
fromIDs <- countyCdLookup(state = 13, county = 5, output = "fullName")
}
......@@ -28,4 +28,3 @@ Robert M. Hirsch \email{rhirsch@usgs.gov}, Laura De Cicco \email{ldecicco@usgs.g
\keyword{USGS,}
\keyword{services}
\keyword{web}
......@@ -12,4 +12,3 @@ getQuerySummary(url)
\description{
getting header information from a WQP query
}
......@@ -29,4 +29,3 @@ obs_url <- constructNWISURL(siteNumber,property,startDate,endDate,'dv')
rawData <- getWebServiceData(obs_url)
}
}
......@@ -38,4 +38,3 @@ data <- importNGWMN_wml2(url)
}
......@@ -89,4 +89,3 @@ fullPath <- file.path(filePath, fileName)
importUserRDB <- importRDB1(fullPath)
}
......@@ -42,4 +42,3 @@ STORETdata <- importWQP(STORETex)
\seealso{
\code{\link{readWQPdata}}, \code{\link{readWQPqw}}, \code{\link{whatWQPsites}}
}
......@@ -107,4 +107,3 @@ importFile <- importWaterML1(fullPath,TRUE)
\seealso{
\code{\link{renameNWISColumns}}
}
......@@ -51,4 +51,3 @@ fullPath <- file.path(filePath, fileName)
UserData <- importWaterML2(fullPath)
}
......@@ -31,4 +31,3 @@ Data pulled from Water Quality Portal on November 25, 2014. The data was pulled
head(pCodeToName[,1:2])
}
\keyword{internal}
......@@ -26,4 +26,3 @@ format=rdb&show=parameter_group_nm&show=parameter_nm&show=casrn&show=srsname&sho
head(parameterCdFile[,1:2])
}
\keyword{internal}
......@@ -45,4 +45,3 @@ noDataSite <- readNGWMNdata(featureID = noDataSite, service = "observation")
}
}
......@@ -32,4 +32,3 @@ noDataSite <- "UTGS.401544112060301"
noDataSite <- readNGWMNlevels(featureID = noDataSite)
}
}
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