From e6eafceb424d06583120bd59c0872756ee0a4748 Mon Sep 17 00:00:00 2001 From: nuest Date: Fri, 12 Apr 2019 18:49:29 +0200 Subject: [PATCH 01/13] add examples to core functions and have less \dontrun also clean up commented sections in Rd files --- man/DescribeSensor.Rd | 11 +++++++--- man/GML.Rd | 37 +++++++++++++-------------------- man/OGC.Rd | 4 ---- man/OWS.Rd | 23 +++++++------------- man/OmMeasurement.Rd | 11 ++-------- man/OmObservation.Rd | 4 ---- man/OmObservationCollection.Rd | 2 -- man/SA.Rd | 6 +----- man/SML.Rd | 26 +++++++++++++++-------- man/SOS.Rd | 23 ++++++++++---------- man/SWE.Rd | 12 ++--------- man/SosCapabilities.Rd | 8 +++---- man/SosContents.Rd | 3 --- man/SosEventTime.Rd | 12 ++++------- man/SosFeatureOfInterest.Rd | 3 --- man/SosFilter_Capabilities.Rd | 7 ++----- man/SosObservationOffering.Rd | 21 ++++++++++++------- man/Supported.Rd | 5 ----- man/encodeRequestXML-methods.Rd | 2 -- man/getObservation-methods.Rd | 25 +++++++++++++++------- man/parse.Rd | 3 --- man/sosCreate.Rd | 9 ++------ 22 files changed, 108 insertions(+), 149 deletions(-) diff --git a/man/DescribeSensor.Rd b/man/DescribeSensor.Rd index 895e81f..3895baf 100644 --- a/man/DescribeSensor.Rd +++ b/man/DescribeSensor.Rd @@ -63,9 +63,6 @@ Class \code{"\linkS4class{OwsServiceOperation}"}, directly. \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{} -%\section{Warning }{} - \seealso{See Also \code{\link{SensorML}} and \link{describeSensor}.} \examples{ @@ -80,6 +77,14 @@ print(describeSensorRequest) sos <- SOS_Test() encodeRequestXML(describeSensorRequest, sos) toString(encodeRequestXML(describeSensorRequest, sos)) + +# request a sensor description +mySOS <- SOS(url = "http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp", + binding = "KVP") +mySensor <- describeSensor(sos = mySOS, + procedure = sosProcedures(mySOS)[[1]], + outputFormat = 'text/xml; subtype="sensorML/1.0.1"', # space is needed! + ) } \keyword{classes} diff --git a/man/GML.Rd b/man/GML.Rd index e0978e8..3be4e36 100644 --- a/man/GML.Rd +++ b/man/GML.Rd @@ -1,8 +1,6 @@ \name{GmlDirectPosition-class} \Rdversion{1.1} -%\docType{class} - \alias{GmlDirectPosition-class} \alias{GmlDirectPositionOrNULL-class} \alias{GmlEnvelope-class} @@ -126,29 +124,29 @@ Objects can be created by calling the according construction functions. e.g. in \usage{ GmlDirectPosition(pos, srsName = as.character(NA), srsDimension = NA_integer_, axisLabels = as.character(NA), uomLabels = as.character(NA)) -GmlDirectPositionLatLon(lat, lon, srsName = as.character(NA), - srsDimension = NA_integer_, - axisLabels = as.character(NA), +GmlDirectPositionLatLon(lat, lon, srsName = as.character(NA), + srsDimension = NA_integer_, + axisLabels = as.character(NA), uomLabels = as.character(NA)) -GmlEnvelope(lowerCorner, upperCorner, srsName = as.character(NA), - srsDimension = NA_integer_, axisLabels = as.character(NA), +GmlEnvelope(lowerCorner, upperCorner, srsName = as.character(NA), + srsDimension = NA_integer_, axisLabels = as.character(NA), uomLabels = as.character(NA)) GmlFeatureCollection(featureMembers, id = as.character(NA)) -GmlPoint(pos, id = as.character(NA), srsName = as.character(NA), - srsDimension = NA_integer_, axisLabels = as.character(NA), +GmlPoint(pos, id = as.character(NA), srsName = as.character(NA), + srsDimension = NA_integer_, axisLabels = as.character(NA), uomLabels = as.character(NA)) GmlPointProperty(href = as.character(NA), point = NULL) GmlFeatureProperty(href = as.character(NA), feature = NULL) -GmlTimeInstant(timePosition, id = as.character(NA), relatedTimes = list(NA), +GmlTimeInstant(timePosition, id = as.character(NA), relatedTimes = list(NA), frame = as.character(NA)) GmlTimeInstantProperty(href = as.character(NA), time = NULL) GmlTimeInterval(interval, unit, radix = NA, factor = NA) -GmlTimePeriod(begin = NULL, beginPosition = NULL, end = NULL, - endPosition = NULL, duration = as.character(NA), - timeInterval = NULL, id = as.character(NA), +GmlTimePeriod(begin = NULL, beginPosition = NULL, end = NULL, + endPosition = NULL, duration = as.character(NA), + timeInterval = NULL, id = as.character(NA), relatedTimes = list(NA), frame = as.character(NA)) -GmlTimePosition(time, frame = as.character(NA), - calendarEraName = as.character(NA), +GmlTimePosition(time, frame = as.character(NA), + calendarEraName = as.character(NA), indeterminatePosition = as.character(NA)) GmlMeasure(value, uom) } @@ -294,10 +292,6 @@ The \verb{"...OrNULL"} classes are used to model optional slots. \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} -%\seealso{} - \examples{ showClass("GmlDirectPosition") showClass("GmlEnvelope") @@ -329,7 +323,7 @@ pos1 <- GmlDirectPosition(pos = "7.0 52.0") show(pos1) # create envelope -env1 <- GmlEnvelope(upperCorner = pos1, +env1 <- GmlEnvelope(upperCorner = pos1, lowerCorner = GmlDirectPosition("6.0 51.0")) print(env1) @@ -360,7 +354,7 @@ GmlTimeInstantProperty(href = "http://link.to/timeInstant") # create different variants of time periods # one hour with time positions -GmlTimePeriod(beginPosition = timePos1, +GmlTimePeriod(beginPosition = timePos1, endPosition = GmlTimePosition(time = timePos1@time+3600)) # one week backwards from now @@ -369,7 +363,6 @@ aWeekAgo <- GmlTimeInstantProperty(time = GmlTimeInstant(time = timePos)) timePos <- GmlTimePosition(time = Sys.time()) now <- GmlTimeInstantProperty(time = GmlTimeInstant(time = timePos)) GmlTimePeriod(begin = aWeekAgo, end = now) - } \keyword{classes} diff --git a/man/OGC.Rd b/man/OGC.Rd index 7e726a1..d11fab8 100644 --- a/man/OGC.Rd +++ b/man/OGC.Rd @@ -130,8 +130,6 @@ Schemas: \url{http://schemas.opengis.net/filter/1.1.0/} \section{Warning }{The encoding functions of these classes are not completely implemented yet.} -%\seealso{} - \examples{ showClass("OgcBBOX") showClass("OgcBinarySpatialOp") @@ -142,8 +140,6 @@ showClass("OgcContains") showClass("OgcOverlaps") showClass("OgcSpatialOps") showClass("OgcSpatialOpsOrNULL") - -# TBD examples for construction functions } \keyword{classes} diff --git a/man/OWS.Rd b/man/OWS.Rd index 9513f82..4cb79d5 100644 --- a/man/OWS.Rd +++ b/man/OWS.Rd @@ -101,23 +101,23 @@ The following classes are virtual and no objects may be created from it: \code{O \usage{ OwsCapabilities(version, updateSequence = NA, owsVersion = sosDefaultGetCapOwsVersion, - identification = NULL, provider = NULL, operations = NULL, + identification = NULL, provider = NULL, operations = NULL, contents = NULL, languages = NULL) OwsException(exceptionCode, exceptionText = c(), locator = as.character(NA)) OwsExceptionReport(version, lang = as.character(NA), exceptions = list(NA)) -OwsGetCapabilities(service, acceptVersions, sections = sosDefaultGetCapSections, - acceptFormats = sosDefaultGetCapAcceptFormats, - updateSequence = c(as.character(NA)), +OwsGetCapabilities(service, acceptVersions, sections = sosDefaultGetCapSections, + acceptFormats = sosDefaultGetCapAcceptFormats, + updateSequence = c(as.character(NA)), owsVersion = sosDefaultGetCapOwsVersion, acceptLanguages = c(NA)) OwsOperation(name, DCPs, parameters = list(NA), constraints = list(NA), metadata = list(NA)) -OwsOperationsMetadata(operations, parameters = list(NA), constraints = list(NA), +OwsOperationsMetadata(operations, parameters = list(NA), constraints = list(NA), extendedCapabilities = xml2::xml_missing()) -OwsRange(minimumValue = as.character(NA), maximumValue = as.character(NA), +OwsRange(minimumValue = as.character(NA), maximumValue = as.character(NA), rangeClosure = as.character(NA), spacing = as.character(NA)) -OwsServiceProvider(providerName, providerSite = as.character(NA), +OwsServiceProvider(providerName, providerSite = as.character(NA), serviceContact = xml2::xml_missing()) -OwsServiceIdentification(serviceType, serviceTypeVersion, profile = c(NA), title, +OwsServiceIdentification(serviceType, serviceTypeVersion, profile = c(NA), title, abstract = c(NA), keywords = c(NA), fees = as.character(NA), accessConstraints = c(NA)) } @@ -269,10 +269,6 @@ Whiteside A., Greenwood, J. (Eds.), OGC Web Services Common Standard, Open Geosp \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} -%\seealso{} - \examples{ showClass("OwsCapabilities_1.1.0") showClass("OwsCapabilities_2.0.0") @@ -292,9 +288,6 @@ showClass("OwsServiceIdentificationOrNULL") showClass("OwsServiceOperation") showClass("OwsServiceProvider") showClass("OwsServiceProviderOrNULL") - -# TBD examples for construction functions - } \keyword{classes} diff --git a/man/OmMeasurement.Rd b/man/OmMeasurement.Rd index db68fe3..84bdd66 100644 --- a/man/OmMeasurement.Rd +++ b/man/OmMeasurement.Rd @@ -31,7 +31,7 @@ Objects can be created by calls to the construction function of the form \code{O \usage{ OmMeasurement(samplingTime, procedure, observedProperty, featureOfInterest, result, - metadata = NA, resultTime = NULL, resultQuality = NA, parameter = NA) + metadata = NA, resultTime = NULL, resultQuality = NA, parameter = NA) } \section{Slots}{ @@ -58,7 +58,7 @@ Class \code{"\linkS4class{OmObservationOrNULL}"}, by class "OmObservation", dist \describe{ \item{sosResult}{\code{signature(obj = "OmMeasurement")}: Get the data in the measurement as a data.frame.} \item{sosGetCRS}{\code{signature(obj = "OmMeasurement")}: Get the coordinate reference system used in the feature of interest.} - + } } @@ -84,17 +84,10 @@ A Measurement contains a \code{\linkS4class{GmlMeasure}}. \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{} -%\section{Warning}{} - \seealso{See also \code{\link{OmObservation-class}}, \code{\linkS4class{GmlMeasure}}.} \examples{ showClass("OmMeasurement") - -# TBD examples for construction function - -# TBD examples for sosResult } \keyword{classes} diff --git a/man/OmObservation.Rd b/man/OmObservation.Rd index 197ce72..f3bc1db 100644 --- a/man/OmObservation.Rd +++ b/man/OmObservation.Rd @@ -107,9 +107,6 @@ The \verb{...OrNULL} classes are used to model optional slots. \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} - \seealso{See Also as \code{\link{OmMeasurement-class}}.} \examples{ @@ -117,7 +114,6 @@ showClass("OmObservation") showClass("OmObservationProperty") showClass("OmObservationOrNULL") -# TBD examples for construction methods OmObservationProperty(href = "http://link.to/myObservation") # get result from an observation diff --git a/man/OmObservationCollection.Rd b/man/OmObservationCollection.Rd index 0a5b5be..143ed8e 100644 --- a/man/OmObservationCollection.Rd +++ b/man/OmObservationCollection.Rd @@ -68,8 +68,6 @@ Objects can be created by calls to the construction function of the form \code{O \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{} - \seealso{ \code{\linkS4class{OmObservation}} or \code{\linkS4class{OmMeasurement}}. } diff --git a/man/SA.Rd b/man/SA.Rd index 8b04b08..6d9cf89 100644 --- a/man/SA.Rd +++ b/man/SA.Rd @@ -76,16 +76,12 @@ SaSamplingPoint(sampledFeatures, position, relatedObservation = list(NA), \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} -%\seealso{} - \examples{ showClass("SaSamplingPoint") # create sampling point SaSamplingPoint(sampledFeatures = list("feature1", "feature2"), position = GmlPointProperty(href = "http://link.to/point")) - } + \keyword{classes} diff --git a/man/SML.Rd b/man/SML.Rd index 4e6a8a0..2a123c1 100644 --- a/man/SML.Rd +++ b/man/SML.Rd @@ -60,20 +60,28 @@ Houbie, F., Skivee F., Robin A., Jirka S., Broering, A., Nuest D. (2009): OGC(R) \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} -%\seealso{} +\seealso{\code{\link{DescribeSensor}}} \examples{ showClass("SensorML") +mySOS <- SOS(url = "http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp", + binding = "KVP") +mySensor <- describeSensor(sos = mySOS, + procedure = sosProcedures(mySOS)[[1]], + outputFormat = 'text/xml; subtype="sensorML/1.0.1"', # space is needed! + ) +class(mySensor) +print(mySensor) + +sosId(mySensor) +sosName(mySensor) +sosBoundedBy(mySensor) +sosCoordinates(mySensor) +sosGetCRS(mySensor) + \dontrun{ -weathersos <- SOS("http://v-swe.uni-muenster.de:8080/WeatherSOS/sos") -proc1 <- sosProcedures(weathersos)[[1]][[1]] -proc1.descr <- describeSensor(weathersos, proc1, verbose = TRUE) -plot(proc1.descr) -class(proc1.descr) -print(proc1.descr +plot(mySensor) } } diff --git a/man/SOS.Rd b/man/SOS.Rd index 1f1af96..58832ae 100644 --- a/man/SOS.Rd +++ b/man/SOS.Rd @@ -341,8 +341,6 @@ SOS_Test(name = "test", binding = SosDefaultBinding(), version = sos100_version, timeFormat = sosDefaultTimeFormat, verboseOutput = FALSE, switchCoordinates = FALSE, useDCPs = TRUE, dcpFilter = SosDefaultDCPs(), additionalKVPs = list(), ...) - -# accessor methods ... } \arguments{ @@ -376,18 +374,26 @@ The document is available for download at \url{https://www.opengeospatial.org/st \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\section{Warning }{} - \seealso{See also creation function \code{\link{SOS}} and the package vignette for general description of use.} \examples{ showClass("SOS") showClass("SOS_2.0.0") -\dontrun{ # create a SOS connection -mysos <- SOS(url = "http://mysos.org/sos") +mySOS <- SOS(url = "http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp", + binding = "KVP") + +# create the URL to a GET request for GetCapabilities +sosCapabilitiesUrl(mySOS) + +# access details of the SOS connection and it's metadata +sosContents(mySOS) +sosTime(mySOS) +sosFeaturesOfInterest(mySOS) +sosBinding(mySOS) +\dontrun{ # create a SOS connetion with a specific connection method and time format mysos <- SOS(url = "http://mysos.org/sos", binding = "KVP", timeFormat = "%Y-%m-%d") @@ -401,9 +407,6 @@ sosExceptionCodeMeaning(ex@exceptionCode) # create a CRS object from a URN CRS string sosGetCRS("urn:ogc:def:crs:EPSG:4217") -# create the URL to a GET request for GetCapabilities -sosCapabilitiesUrl(mysos) - # create a SOS for a specific binding at a specific endpoint SOS(url = "http://localhost:8080/52n-sos/sos/pox", binding = "POX", useDCPs = FALSE) @@ -414,8 +417,6 @@ SOS(url = "http://localhost:8080/52n-sos/sos/service", dcpFilter = list("POX" = "/pox")) } - - } \keyword{classes} diff --git a/man/SWE.Rd b/man/SWE.Rd index 0db668c..21647fb 100644 --- a/man/SWE.Rd +++ b/man/SWE.Rd @@ -44,7 +44,7 @@ The following classes are virtual, no objects may be created from them: \code{Sw } \usage{ -SweCompositePhenomenon(id, name, description = as.character(NA), dimension, +SweCompositePhenomenon(id, name, description = as.character(NA), dimension, components, base = NULL) SwePhenomenon(id, name, description = as.character(NA)) SwePhenomenonProperty(href = as.character(NA), phenomenon = NULL) @@ -105,7 +105,7 @@ Arguments of the construction functions are as follows. } \details{ -The \verb{...OrNULL} classes are used to model optional slots. +The \verb{...OrNULL} classes are used to model optional slots. } \value{The construction functions return an object of the respective class.} @@ -114,20 +114,12 @@ The \verb{...OrNULL} classes are used to model optional slots. \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} -%\seealso{} - \examples{ showClass("SweCompositePhenomenon") showClass("SwePhenomenon") showClass("SwePhenomenonProperty") showClass("SwePhenomenonPropertyOrNULL") showClass("SweTextBlock") - - -# TBD examples for construction functions - } \keyword{classes} diff --git a/man/SosCapabilities.Rd b/man/SosCapabilities.Rd index 9edfedd..e93c1b5 100644 --- a/man/SosCapabilities.Rd +++ b/man/SosCapabilities.Rd @@ -43,7 +43,7 @@ No methods defined with class "SosCapabilities_1.0.0" in the signature. } \usage{ -SosCapabilities(version, updateSequence = NA, owsVersion = "1.1.0", +SosCapabilities(version, updateSequence = NA, owsVersion = "1.1.0", identification = NULL, provider = NULL, operations = NULL, filterCapabilities = NULL, contents = NULL) } @@ -69,15 +69,13 @@ The portions of the GetCapabilities response document that are defined in the OW \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} - \seealso{ \code{\linkS4class{SosFilter_Capabilities}}, \code{\linkS4class{SosContents}}, \code{\linkS4class{OwsCapabilities}} } \examples{ showClass("SosCapabilities_1.0.0") +showClass("SosCapabilities_2.0.0") } -\keyword{classes} +\keyword{classes} diff --git a/man/SosContents.Rd b/man/SosContents.Rd index cac9e4d..8ca443d 100644 --- a/man/SosContents.Rd +++ b/man/SosContents.Rd @@ -58,9 +58,6 @@ The SosContents section extends the generic ows:Contents elements. It contains t \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} - \seealso{\code{\linkS4class{SosObservationOffering}}, \code{\linkS4class{OwsContents}} } diff --git a/man/SosEventTime.Rd b/man/SosEventTime.Rd index 6348274..464e9ac 100644 --- a/man/SosEventTime.Rd +++ b/man/SosEventTime.Rd @@ -63,25 +63,21 @@ It is recommended to use the creation functions as shown in the examples. \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} - \seealso{See also \code{\link{SosGetObservation-class}}, \code{\link{sosCreateEventTimeList-methods}}.} \examples{ showClass("SosEventTime") -\dontrun{ # create SosEventTime for all times after the given time stamp timePos <- GmlTimePosition(as.POSIXct("2010-01-01 12:00")) tOps <- TM_After(time = GmlTimeInstant(timePosition = timePos)) time1 <- SosEventTime(tOps) -# encode it as XML and KVP -encodeXML(time1) -encodeKVP(time1) -} +# encode it as XML +encodeXML(time1, sos = SOS_Test()) +# encode it as KVP +encodeKVP(time1, sos = SOS_Test()) } \keyword{classes} diff --git a/man/SosFeatureOfInterest.Rd b/man/SosFeatureOfInterest.Rd index 2d9b2c0..b72cd72 100644 --- a/man/SosFeatureOfInterest.Rd +++ b/man/SosFeatureOfInterest.Rd @@ -52,9 +52,6 @@ Specifies the feature for which observations are requested. This can either be r \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} - \seealso{ See also \code{\linkS4class{SosGetObservation}}, and the convenience creation function \code{\link{sosCreateFeatureOfInterest-methods}}. } diff --git a/man/SosFilter_Capabilities.Rd b/man/SosFilter_Capabilities.Rd index efdc4d8..e5bcaa5 100644 --- a/man/SosFilter_Capabilities.Rd +++ b/man/SosFilter_Capabilities.Rd @@ -19,11 +19,11 @@ Additional section in the service metadata document of a Sensor Observation Serv \section{Objects from the Class}{ Objects can be created by calls of the form \code{new("SosFilter_Capabilities", ...)}. -\code{SosFilter_CapabilitiesOrNULL} is virtual class: No objects may be created from it. +\code{SosFilter_CapabilitiesOrNULL} is virtual class: No objects may be created from it. } \usage{ -SosFilter_Capabilities(spatial = list(NA_character_), temporal = list(NA_character_), +SosFilter_Capabilities(spatial = list(NA_character_), temporal = list(NA_character_), scalar = list(NA_character_), id = list(NA_character_)) } @@ -63,9 +63,6 @@ See section 8.2.3.1, \dQuote{FilterCapabilities Section}, the SOS specification: \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} - \seealso{\code{\linkS4class{SosCapabilities}}} \examples{ diff --git a/man/SosObservationOffering.Rd b/man/SosObservationOffering.Rd index c911f7a..38e264f 100644 --- a/man/SosObservationOffering.Rd +++ b/man/SosObservationOffering.Rd @@ -36,9 +36,9 @@ Objects can be created by calls to the construction functions of the form \code{ \usage{ SosObservationOffering(id, name = as.character(NA), time, procedure, observedProperty, - featureOfInterest, responseFormat, - intendedApplication = as.character(NA), - resultModel = as.character(NA), + featureOfInterest, responseFormat, + intendedApplication = as.character(NA), + resultModel = as.character(NA), responseMode = as.character(NA), boundedBy = list()) } @@ -90,14 +90,21 @@ See section 6.3, \dQuote{Observation Offerings}, of the SOS specification: Na, A \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{ } -%\section{Warning }{} - \seealso{\code{\linkS4class{SosContents}}, \code{\linkS4class{SosCapabilities}}} \examples{ showClass("SosObservationOffering") -# TBD examples for construction functions +showClass("SosObservationOffering_2.0.0") + +# explore offerings of an SOS +mySOS <- SOS(url = "http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp", + binding = "KVP") +offering1 <- sosOfferings(mySOS)[[1]] + +sosId(offering1) +sosName(offering1) +sosTime(offering1) +sosBoundedBy(offering1) } \keyword{classes} diff --git a/man/Supported.Rd b/man/Supported.Rd index 68bb339..efd1200 100644 --- a/man/Supported.Rd +++ b/man/Supported.Rd @@ -43,13 +43,8 @@ It is encouraged to rather use these methods than manually set character values \value{A list of supported values for the respective parameter.} -%\references{} - \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{} -%\section{Warning }{} - \seealso{See \code{\link{Defaults}} for default values of parameters.} \examples{ diff --git a/man/encodeRequestXML-methods.Rd b/man/encodeRequestXML-methods.Rd index 584c0f8..01da460 100644 --- a/man/encodeRequestXML-methods.Rd +++ b/man/encodeRequestXML-methods.Rd @@ -29,8 +29,6 @@ These methods encode objects representing requests to a Sensor Observation Servi } } -%\details{} - \references{Annex A (normative) \dQuote{SOS Schema} in Na, A., Priest, M. (Eds.), Sensor Observation Service, Open Geospatial Consortium Inc., OGC 06-009r6, Version: 1.0.} \seealso{\code{\link{SosBindings}}, \code{\link{encodeXML}}} diff --git a/man/getObservation-methods.Rd b/man/getObservation-methods.Rd index 1ef331f..5ed40ba 100644 --- a/man/getObservation-methods.Rd +++ b/man/getObservation-methods.Rd @@ -38,13 +38,24 @@ This method sends a GetObservation request to the given SOS. \examples{ \dontrun{ -# by identifier -sos <- SOS(...) -os.offerings <- sosOfferings(sos) -obsId <- getObservationById(sos = sos, observationId = "o_3508493") - -# TODO - +# request observations +mySOSpox <- SOS(url = "http://sensorweb.demo.52north.org/sensorwebtestbed/service/pox", + binding = "POX", useDCPs = FALSE) + +myOffering <- sosOfferings(mySOS)[["ws2500"]] +period <- sosCreateTimePeriod(sos = mySOS, + begin = as.POSIXct("2015/11/01"), + end = as.POSIXct("2015/11/02")) +eventTime <- sosCreateEventTimeList(period) + +nov2015 <- getObservation(sos = mySOSpox, + offering = myOffering, + eventTime = eventTime) + +# request observation by identifier and get the data +obsId <- getObservationById(sos = mySOSpox, + observationId = "http://www.52north.org/test/observation/1") +sosResult(obsId, coordinates = TRUE) } } diff --git a/man/parse.Rd b/man/parse.Rd index c143208..2f99fb3 100644 --- a/man/parse.Rd +++ b/man/parse.Rd @@ -160,15 +160,12 @@ Not all parsing function that have a \code{SOS} object or \code{verbose} in thei \value{An objects of a specific class depending on the parsing method and the passed object, possibly even lists or named character vectors.} -%\references{} - \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} \section{Warning }{ Functions might result in error if parsed an object of the wrong type, because that is normally not checked. Some of the functions are placeholders for future implementations! - } \seealso{\code{\link{SosParsingFunctions}}, \code{\link{sosParsers-methods}}} diff --git a/man/sosCreate.Rd b/man/sosCreate.Rd index c0a492e..481fa6f 100644 --- a/man/sosCreate.Rd +++ b/man/sosCreate.Rd @@ -82,8 +82,6 @@ sosCreateTime(sos, time, operator = sosDefaultTemporalOperator) \author{Daniel Nuest \email{daniel.nuest@uni-muenster.de}} -%\note{} - \seealso{These methods create object of the following classes: \code{\link{GmlTimeInstant-class}}, \code{\link{GmlTimePeriod-class}}, \code{\link{SosEventTime-class}}, \code{\link{SosFeatureOfInterest-class}}, \code{\link{OgcBBOX-class}}, \code{\link{matrix-class}}.} \section{Methods}{ @@ -96,7 +94,6 @@ sosCreateTime(sos, time, operator = sosDefaultTemporalOperator) } \examples{ - # create a feature of interest based on identifiers foiIDs <- list("urn:ogc:object:feature:1", "urn:ogc:object:feature:2") foiObj <- sosCreateFeatureOfInterest(objectIDs = foiIDs[1:2]) @@ -117,11 +114,10 @@ bbox <- sosCreateBBOX(lowLat = 50.0, lowLon = 7.0, uppLat = 53.0, uppLon = 10.0, foiBBox2 <- sosCreateFeatureOfInterest(spatialOps = bbox) print(foiBBox2) -\dontrun{ -last.period <- sosCreateTimePeriod(sos = mySOS, +last.period <- sosCreateTimePeriod(sos = SOS_Test(), begin = (Sys.time() - 3600 * 24 * 7), end = Sys.time()) -period <- sosCreateTimePeriod(sos = mySOS, +period <- sosCreateTimePeriod(sos = SOS_Test(), begin = as.POSIXct("2010/01/01"), end = as.POSIXct("2010/01/07")) eventTime <- sosCreateEventTimeList(period) @@ -130,7 +126,6 @@ sosCreateTime(sos = mySOS, time = "2007-07-07 07:00/2010-10-10 10:00") sosCreateTime(sos = mySOS, time = "::2007-08-05") sosCreateTime(sos = mySOS, time = "2007-08-05/") -} } From cfccdf1e7008ceb4b3f35ce6ef28702d52c10c2e Mon Sep 17 00:00:00 2001 From: nuest Date: Fri, 12 Apr 2019 19:04:03 +0200 Subject: [PATCH 02/13] clean up demos, closes #11 #67 --- demo/00Index | 14 +- demo/ades.R | 20 --- demo/airquality.R | 246 ---------------------------- demo/austria.R | 177 -------------------- demo/co-ops.R | 92 ++++++----- demo/coastlab.R | 125 --------------- demo/eo2heaven.R | 243 ---------------------------- demo/ioos.R | 54 ++----- demo/marinemeta.R | 56 ------- demo/oceanwatch.R | 42 ----- demo/pegel.R | 8 +- demo/southesk.R | 400 ---------------------------------------------- 12 files changed, 66 insertions(+), 1411 deletions(-) delete mode 100644 demo/ades.R delete mode 100644 demo/airquality.R delete mode 100644 demo/austria.R delete mode 100644 demo/coastlab.R delete mode 100644 demo/eo2heaven.R delete mode 100644 demo/marinemeta.R delete mode 100644 demo/oceanwatch.R delete mode 100644 demo/southesk.R diff --git a/demo/00Index b/demo/00Index index 0febccd..4add912 100644 --- a/demo/00Index +++ b/demo/00Index @@ -1,11 +1,3 @@ -ades demo script for SOS with French groundwater level data -airquality spatial analysis demo for air quality SOS by ifgi and EEA -austria demo script for SOSs by Research Studios Austria -coastlab demo script for SOSs by Helmholtz-Zentrum Geesthacht -co-ops [under construction] demo script for SOSs by the NOAA Center for Operational Oceanographic Products and Services focussing on non-O&M response formats and filtering -ioos demo script for SOS by Integrated Ocean Observing System -marinemeta demo script for SOS by Marine Metadata Interoperability Initiative -oceanwatch demo script for SOS by NOAA/SWFSC/ERD -pegel demo script for water gauge data in Germany by Pegelonline -southesk plotting and data consilidation demo for SOSs from South Esk Testbed by CSIRO -eo2heaven health-related and air quality SOS for the state of Saxony, Germany, and Durban, South Africa by TU Dresden +co-ops SOSs by the NOAA Center for Operational Oceanographic Products and Services focussing on non-O&M response formats and filtering +ioos SOS by Integrated Ocean Observing System +pegel Water gauge data in Germany by Pegelonline \ No newline at end of file diff --git a/demo/ades.R b/demo/ades.R deleted file mode 100644 index f5a295f..0000000 --- a/demo/ades.R +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (C) 2019 by 52 North Initiative for Geospatial Open Source Software GmbH, Contact: info@52north.org -# This program is free software; you can redistribute and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed WITHOUT ANY WARRANTY; even without the implied WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see gpl-2.0.txt). If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or visit the Free Software Foundation web page, http://www.fsf.org. -# Author: Daniel Nuest (daniel.nuest@uni-muenster.de) -# Project: sos4R - visit the project web page: https://github.com/52North/sos4R -library("sos4R") - -############################################################################## -# ADES -ades <- SOS(url = "http://sosades.brgm.fr/REST/sos", - binding = SosSupportedBinding()[["KVP"]]) -print(object.size(ades), units=c("Mb")) -# 7.8 Mb, large capabilities file! - -ades.off <- sosOfferingIds(ades) - -# TODO - -################################### -# Demo finished, try another one! # -################################### diff --git a/demo/airquality.R b/demo/airquality.R deleted file mode 100644 index 1ed2d0e..0000000 --- a/demo/airquality.R +++ /dev/null @@ -1,246 +0,0 @@ -# Copyright (C) 2019 by 52 North Initiative for Geospatial Open Source Software GmbH, Contact: info@52north.org -# This program is free software; you can redistribute and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed WITHOUT ANY WARRANTY; even without the implied WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see gpl-2.0.txt). If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or visit the Free Software Foundation web page, http://www.fsf.org. -# Author: Daniel Nuest (daniel.nuest@uni-muenster.de) -# Edzer Pebesma (edzer.pebesma@uni-muenster.de) -# Project: sos4R - visit the project web page: https://github.com/52North/sos4R -library("sos4R") - -################################################################################ -# AQE SOS -# Data source: http://www.eea.europa.eu/themes/air/airbase - -# Set the converters for observed properties: -aqe.converters <- SosDataFieldConvertingFunctions( - "http://giv-genesis.uni-muenster.de:8080/SOR/REST/phenomenon/OGC/Concentration[PM10]" = sosConvertDouble, - "http://giv-genesis.uni-muenster.de:8080/SOR/REST/phenomenon/OGC/Concentration[NO2]" = sosConvertDouble, - "http://giv-genesis.uni-muenster.de:8080/SOR/REST/phenomenon/OGC/Concentration[O3]" = sosConvertDouble, - "http://www.opengis.net/def/property/OGC/0/SamplingTime" = sosConvertTime, - "http://www.opengis.net/def/property/OGC/0/FeatureOfInterest" = sosConvertString) - -# Create the SOS connection: -aqe <- SOS(url = "http://giv-uw.uni-muenster.de:8080/AQE/sos", - dataFieldConverters = aqe.converters) -summary(aqe) - -# Get the available offerings: -aqe_offerings <- sosOfferings(aqe) -names(aqe_offerings) - -########### -# Plot SOS: -library(maps); library(mapdata); library(maptools) -if(!require(rgdal, quietly = TRUE)) - print("rgdal not present: CRS values will not be converted correctly") -data(worldHiresMapEnv) -crs <- sosGetCRS(aqe)[[1]] -region <- map.where(database = "worldHires", - sosCoordinates(aqe_offerings)) # find region -worldHigh <- pruneMap(map(database = "worldHires", region = region, - plot = FALSE)) -worldHigh_Lines <- map2SpatialLines(worldHigh, proj4string = crs) - -plot(worldHigh_Lines, col = "grey50") -plot(aqe, add = TRUE, lwd = 3) -title(main = paste("Offerings Germany by '", sosTitle(aqe), "'", sep = ""), - sub = toString(names(aqe_offerings))) - -################################################################################ -# NO2 -# -# Extract one offering of interest and explore: -aqe_off_no2 <- aqe_offerings[["NO2"]] -aqe_off_no2 -summary(aqe_off_no2) - -# Get observations, december 2003 is arbitrary choice! -dec2003.12Hrs = sosCreateTime(sos = aqe, - time = "2003/12/01 08:00::2003/12/01 20:00") -dec2003.24Hrs = sosCreateTime(sos = aqe, - time = "2003/12/01 08:00::2003/12/02 08:00") -dec2003 = sosCreateTime(sos = aqe, time = "2003/12/01::2003/12/31") - -# Request data (request and response can be check by setting the inspect=TRUE): -obs_no2_12Hrs <- getObservation(sos = aqe, # inspect = TRUE, - offering = aqe_off_no2, - #procedure = sosProcedures(aqe.off.no2)[1:20], - saveOriginal = TRUE, # saves file in getwd() - eventTime = dec2003.12Hrs) -# 38 secs - -################################################ -# Reloading the file later for further analysis: -# Use the file name printed out by the getObservation(...) call or check your -# working directory: -list.files(path = getwd(), pattern = sosName(aqe_off_no2)) -#parseFile("NO2_2011-03-03_11:31:23.xml") - -############################################## -# Explore the returned observation collection: -obs_no2_12Hrs -# There is one observatio for every FOI / procedure combination : -names(obs_no2_12Hrs)[1:3] - -######################## -# Subset the collection: -# (features, observed properties and procedures): -# sosFeatureIds(obs.no2.12Hrs)[c(1,100)] -obs_no2_12Hrs[sosFeatureIds(obs_no2_12Hrs)[c(1,100)]] -# sosObservedProperties(obs.no2.12Hrs)[2] -obs_no2_12Hrs[sosObservedProperties(obs_no2_12Hrs)[2]] -# sosProcedures(obs.no2.12Hrs)[200:201] -obs_no2_12Hrs[sosProcedures(obs_no2_12Hrs)[200:201]] - -# More requests for more data for testing of response time: -#obs.no2.24Hrs <- getObservation(sos = aqe, # inspect = TRUE, -# offering = aqe.off.no2, -# eventTime = dec2003.24Hrs) -## 41 secs -#obs.no2.dec <- getObservation(sos = aqe, # inspect = TRUE, -# offering = aqe.off.no2, -# eventTime = dec2003) -## 3:25 mins -#obs.no2.dec -#result.no2.dec <- sosResult(obs.no2.dec)[1:10, ] - - -################################################################################ -# Get the result data for all observations, with coordinates: -result_no2_12Hrs <- sosResult(obs_no2_12Hrs, coordinates = TRUE) -# Coordinates only: -#sosCoordinates(obs.no2.12Hrs[1:10]) -# One observation only -# sosResult(obs.no2.12Hrs[[42]]) - -summary(result_no2_12Hrs) -NO2 <- colnames(result_no2_12Hrs)[[3]] - -################################################# -# Subset and sort the data with subset or sort_df -subset(result_no2_12Hrs, feature=="foi_DEBY109") -library("reshape") -# The ten highest values: -tail(sort_df(result_no2_12Hrs, NO2), 10) - -######################## -# Histogram of NO2 data: -hist(result_no2_12Hrs[,3], main = "NO2") -# Test plot: -plot(result_no2_12Hrs[["SamplingTime"]], result_no2_12Hrs[[NO2]]) - - -################################################################################ -# Get the result data and create sp object: -obs.no2.crs <- sosGetCRS(obs_no2_12Hrs) -no2_spdf <- SpatialPointsDataFrame( - coords = result_no2_12Hrs[,c("lon", "lat")], - data = result_no2_12Hrs[,c("SamplingTime", "feature", NO2)], - proj4string = obs.no2.crs) -bbox(no2_spdf) -#obs.no2.bbox <- sosBoundedBy(obs.no2.12Hrs, bbox = TRUE) # equal -summary(no2_spdf) - -######################################### -# Shortcut to get SpatialPointsDataFrame: -#as(obs.no2.12Hrs[[1]], "SpatialPointsDataFrame") -no2_spdf_shortcut <- as(obs_no2_12Hrs, "SpatialPointsDataFrame") -summary(no2_spdf_shortcut) - -#################################### -# Plot stations with background map: -library("mapdata") -germany_p <- pruneMap(map(database = "worldHires", region = "Germany", - plot = FALSE)) -germany_sp <- map2SpatialLines(germany_p, proj4string = obs.no2.crs) -proj4string(germany_sp) <- obs.no2.crs -plot(x = germany_sp, col = "grey") -plot(no2_spdf, pch = 20, col = "blue", add = TRUE) -title("NO2 Germany") - -############## -# Bubble plot: -bubble(no2_spdf, zcol = 3, maxsize = 2, col = c("#1155ff"), - main = "NO2 in Germany", do.sqrt = TRUE) - -################################################################################ -# Transform to UTM for kriging and background map: -utm32 = CRS("+proj=utm +zone=32 +datum=WGS84") -germany_utm <- spTransform(germany_sp, utm32) -no2_spdf_utm = spTransform(no2_spdf, utm32) -plot(germany_utm, col = "grey") -points(no2_spdf_utm, cex=.5, pch=3) -title(main = "NO2 Sensor Stations, Germany", sub = "UTM projection") - -################################################################################ -# Spatial interpolation, averaging over (essentially ignoring) time: -library(cshapes) # get a polygon of Germany, rather than a set of lines: -cs = cshp() -g = spTransform(cs[cs$CNTRY_NAME=="Germany",], utm32) -# create a grid of points within Germany: -grdpoints = SpatialPoints(makegrid(germany_utm),utm32) -grd = SpatialPixels(grdpoints)[g] -names(no2_spdf_utm)[3] = "NO2" -library(gstat) -no2.id = idw(NO2~1, no2_spdf_utm, grd) -lt=list(list("sp.polygons", g), - list("sp.points", no2_spdf_utm, col=grey(.7), cex=.5)) -spplot(no2.id[1], sp.layout = lt, col.regions = bpy.colors(), - main = paste("IDW Interpolation of NO2,", - min(no2_spdf_utm$SamplingTime), "to", - max(no2_spdf_utm$SamplingTime))) - -## now get the values of 2003-12-01 12:00:00 CET, or the third time stamp -# by creating a spatio-temporal structure, and indexing the time axis: -t12h = unique(no2_spdf_utm$SamplingTime)[3] -library(spacetime) -no2_stidf = STIDF(as(no2_spdf_utm, "SpatialPoints"), - no2_spdf_utm$SamplingTime, data.frame(NO2 = no2_spdf_utm$NO2)) -no2_stfdf = as(no2_stidf, "STFDF") -no2_12h = no2_stfdf[,3,"NO2"] -no2_12h2 = no2_stfdf[,t12h,"NO2"] -all.equal(no2_12h, no2_12h2) -# inverse distance interpolation of the 12:00h NO2 values: -no2_12h_id = idw(NO2~1, no2_12h[!is.na(no2_12h$NO2),], grd) -spplot(no2_12h_id[1], sp.layout = lt, col.regions = bpy.colors(), - main = paste("IDW Interpolation of NO2,", t12h)) - -################################################################################ -# Plot with whole year 2004 for one station: -# See http://www.eea.europa.eu/themes/air/airbase/map-stations. -denw095 <- "urn:ogc:object:feature:Sensor:EEA:airbase:4.0:DENW095" -denw095_descr <- describeSensor(aqe, denw095) -denw095_descr -#denw095.descr@xml - -# Get the identifier of the station: -denw095_id <- xml2::xml_text(x = xml2::xml_find_all(x = denw095_descr@xml, - xpath = "//sml:Term[@definition='urn:ogc:def:identifier:OGC:1.0:longName']/sml:value/text()", - namespaces = sos4R:::.sos100_NamespaceDefinitionsSML)) - -# Request observations: -obs_denw095_2004 <- getObservation(sos = aqe, # inspect = TRUE, - offering = aqe_off_no2, - procedure = denw095, - eventTime = sosCreateEventTimeList(sosCreateTimePeriod(sos = aqe, - begin = as.POSIXct("2004/01/01"), - end = as.POSIXct("2004/12/31"))) -) - -# Print statistical information and plot time series: -data_denw095_2004 <- sosResult(obs_denw095_2004) -summary(data_denw095_2004) - -denw095.NO2.attributes <- attributes(data_denw095_2004[[NO2]]) -plot(data_denw095_2004[["SamplingTime"]], data_denw095_2004[[NO2]], type = "l", - main = paste("NO2 in", denw095_id, "2004"), sub = denw095, - xlab = "Time", - ylab = paste("NO2 (", - denw095.NO2.attributes[["unit of measurement"]], - ")", sep = "")) -data.denw095.2004.locRegr = loess(data_denw095_2004[[NO2]]~as.numeric(data_denw095_2004[["SamplingTime"]]), - data_denw095_2004, enp.target = 30) -p = predict(data.denw095.2004.locRegr) -lines(p ~ data_denw095_2004[["SamplingTime"]], col = 'blue',lwd = 4) - -################################### -# Demo finished, try another one! # -################################### diff --git a/demo/austria.R b/demo/austria.R deleted file mode 100644 index eb744a5..0000000 --- a/demo/austria.R +++ /dev/null @@ -1,177 +0,0 @@ -# Copyright (C) 2019 by 52 North Initiative for Geospatial Open Source Software GmbH, Contact: info@52north.org -# This program is free software; you can redistribute and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed WITHOUT ANY WARRANTY; even without the implied WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see gpl-2.0.txt). If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or visit the Free Software Foundation web page, http://www.fsf.org. -# Author: Daniel Nuest (daniel.nuest@uni-muenster.de) -# Project: sos4R - visit the project web page: https://github.com/52North/sos4R -library("sos4R") - -################################################################################ -# http://ispacevm10.researchstudio.at/sostester/ -# Contact: Michael Lippautz: michael.lippautz@researchstudio.at -# Use the two development services on ispacevm10. - -# PROBLEMS using GET: -# - Temporal filtering has no effect... - -################################################################################ -# Nationalpark Berchtesgaden -npbg_converter <- SosDataFieldConvertingFunctions( - "urn:ogc:def:property:OGC:Time:iso8601" = sosConvertTime, - "urn:ogc:def:property:OGC:Reflection" = sosConvertDouble, - "urn:ogc:def:property:OGC:Insolation" = sosConvertDouble) -npbg <- SOS("http://ispacevm10.researchstudio.at/geoservices/npbg", - binding = "KVP", - #verboseOutput = TRUE, - dataFieldConverters = npbg_converter, - sections = NA) -npbg -summary(npbg) - -################# -# Plot whole sos: -library(maps); library(mapdata); library(maptools) -data(worldHiresMapEnv) -crs <- unique(sosGetCRS(npbg))[[1]] -worldHigh <- pruneMap(map(database = "worldHires", region = "Austria", - plot = FALSE)) -worldHigh_Lines <- map2SpatialLines(worldHigh, proj4string = crs) - -plot(worldHigh_Lines, col = "grey50") -plot(npbg, add = TRUE, lwd = 2) -map.axes() -map.scale() -offNames <- sapply(names(sosOfferings(npbg)), FUN = strsplit, split = ":") -title(main = paste("Offerings by '", sosTitle(npbg), "'", sep = ""), - sub = toString(sapply(offNames, "[[", 3))) - -########## -# zoom in: -poly1 <- as(sosOfferings(npbg)[[1]], "Spatial") -bbox(poly1) - -bounds <- sosBoundedBy(sosOfferings(npbg), bbox = TRUE) -bounds_xlim <- c(min(sapply(bounds, "[[", "coords.lon", "min")) - 0.2, - max(sapply(bounds, "[[", "coords.lon", "max")) + 0.2) -bounds_ylim <- c(min(sapply(bounds, "[[", "coords.lat", "min") - 0.2), - max(sapply(bounds, "[[", "coords.lat", "max")) + 0.2) -# increase a little bit (works only because all > 0 - -# run same code again: -plot(worldHigh_Lines, col = "grey50", xlim = bounds_xlim, ylim = bounds_ylim) -plot(npbg, add = TRUE, lwd = 2) -map.axes() -map.scale() -offNames <- sapply(names(sosOfferings(npbg)), FUN = strsplit, split = ":") -title(main = paste("Offerings by '", sosTitle(npbg), "'", sep = ""), - sub = toString(sapply(offNames, "[[", 3))) - -# plot stations NOT POSSIBLE because SOS expects parameter "SensorId", not -# "procedure": -# http://ispacevm10.researchstudio.at/geoservices/npbg?service=SOS&request=DescribeSensor&version=1.0.0&SensorId=org%3Anpbg%3ABlaueis&outputFormat=text/xml;subtype%3D%22sensorML/1.0.1%22 -#describeSensor(npbg, procedure = "org:npbg:Blaueis", verbose = TRUE) -#npbg_procedures <- unique(unlist(sosProcedures(npbg))) -#procs_descr <- lapply(X = npbg_procedures, FUN = describeSensor, # verbose = TRUE, -# sos = npbg) -#procs_descr[[1]] -#for (x in procs_descr) { -# plot(x, add = TRUE, pch = 19) -#} -#text(sosCoordinates(procs_descr)[c("x", "y")], labels = sosId(procs_descr), -# pos = 4) - -######################### -# superordinate offering: -np.off <- sosOfferings(npbg)[["org:npbg:Nationalpark"]] -#np.off -summary(np.off) - -npbg_obsProp <- sosObservedProperties(np.off) -npbg_obsProp -npbg_proc <- sosProcedures(np.off) -npbg_proc - -########### -# Get data: -lastDay <- sosCreateTimePeriod(sos = npbg, begin = (Sys.time() - 3600 * 24), - end = Sys.time()) - -obs_proc1 <- getObservation(sos = npbg, offering = np.off, inspect = TRUE, - procedure = npbg_proc[[1]], - eventTime = sosCreateEventTimeList(lastDay) - ) - -# cannot get the coordinates automatically via sosResult(), because they are -# given as attribute, not as a featureOfInterest -#result.proc1 <- sosResult(obs.proc1, coordinates = TRUE) -#spdf.proc1 <- as(obs.proc1, "Spatial") - -# Coordinates inline: -result_proc1 <- sosResult(obs_proc1) -summary(result_proc1) - -coords.proc1 <- unique(result_proc1[c("Latitude", "Longitude")]) -coords.proc1 - -################## -# plot all values: -names(result_proc1) -plot(result_proc1[8:9], - main = paste(npbg_proc[[1]], "at", toString(coords.proc1), "from, to", - toString(range(result_proc1[["Time"]])))) - -###################### -# xyplot, dotplot ...: -xyplot(Insolation ~ RelativeHumidity, data = result_proc1, - main = paste(npbg_proc[[1]], "(", - toString(coords.proc1), ")"), - sub = paste("Time range: ", toString(range(result_proc1[["Time"]])))) - -xyplot(Insolation ~ RelativeHumidity | AirTemperature, - data = result_proc1[1:100,]) - -dotplot(Insolation ~ RelativeHumidity, data = result_proc1) - -#################################### -# plot values against time with xts: -result_proc1_times <- unique(result_proc1[["Time"]]) - -library(xts) -proc1_xts_refl <- xts(x = result_proc1[["Reflection"]], - order.by = result_proc1[["Time"]], unique = TRUE) -proc1_xts_inso <- xts(x = result_proc1[["Insolation"]], - order.by = result_proc1[["Time"]], unique = TRUE) -plot(proc1_xts_refl, - main = paste("Reflection at", npbg_proc[[1]], "(", - toString(coords.proc1), ")"), - type = "bars") - -############################ -# plot time series with zoo: -library(zoo) - -proc1_zoo <- zoo(x = as.matrix(result_proc1[5:9]), - order.by = result_proc1[["Time"]]) -str(proc1_zoo) -plot(proc1_zoo, main = paste("Time Series at", npbg_proc[[1]], "(", - toString(coords.proc1), ")"), - plot.type = "multiple") - -#################### -# request more data: -obs_proc123 <- getObservation(sos = npbg, offering = np.off, # inspect = TRUE, - procedure = npbg_proc[1:3]) -#Finished getObservation to http://ispacevm10.researchstudio.at/geoservices/npbg -#--> received 3 observation(s) having 31345 result values [ 8942, 11112, 11291 ]. -obs_proc123 -str(obs_proc123[[1]]) -sosProcedures(obs_proc123) - -################################################################################ -# Land Oberoesterreich -ooe <- SOS("http://ispacevm10.researchstudio.at/geoservices/ooe", sections = NA, - verboseOutput = TRUE) -ooe -summary(ooe) - -################################### -# Demo finished, try another one! # -################################### diff --git a/demo/co-ops.R b/demo/co-ops.R index c6e422c..175691c 100644 --- a/demo/co-ops.R +++ b/demo/co-ops.R @@ -1,47 +1,45 @@ -# Copyright (C) 2019 by 52 North Initiative for Geospatial Open Source Software GmbH, Contact: info@52north.org -# This program is free software; you can redistribute and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed WITHOUT ANY WARRANTY; even without the implied WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see gpl-2.0.txt). If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or visit the Free Software Foundation web page, http://www.fsf.org. -# Author: Daniel Nuest (daniel.nuest@uni-muenster.de) -# Project: sos4R - visit the project web page: https://github.com/52North/sos4R -library("sos4R") - - -################################################################################ -# NOAA Center for Operational Oceanographic Products and Services (CO-OPS) -# http://oceanservice.noaa.gov/programs/coops/ -# -# CO-OPS SOS Services -# -# Related to demo "IOOS", CO-OPS' Implementation of IOOS -# -# https://geossregistries.info/geosspub/component_details_ns.jsp?compId=urn:uuid:c1af67f9-4a1b-42d2-b352-e2fdb3bcdeb1 -# request examples at http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/ -# Also good information about existing/active stations! -# -# Presentation: http://sdf.ndbc.noaa.gov/sos/IOOS_DIF_SOS_Project.ppt -# - -################################################################################ -ioosdif <- SOS(url = "http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS") -ioosdif_off <- sosOfferings(ioosdif) -sosName(ioosdif_off) - -length(ioosdif_off) -# 771 - -# -sosResponseFormats(ioosdif) -# TODO test with tab seperated values - -#sosObservedProperties(ioosdif_off) -unique(unlist(sosObservedProperties(ioosdif_off))) - -#CO-OPS has expanded its SOS services with an addition of the following 3 new services. -# -#High Low Tide Predictions -#Relative Humidity -#Rain Fall -# -# -#These services are offered for single station and as collections and in the following data formats; CSV, TSV. -#Please note that these services are presently available on the evaluation test site (http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos-test/). -#On January 24th, 2012 at 10:00 am EST, CO-OPS will add these new changes to our operational SOS web site (http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/). +# Copyright (C) 2019 by 52 North Initiative for Geospatial Open Source Software GmbH, Contact: info@52north.org +# This program is free software; you can redistribute and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed WITHOUT ANY WARRANTY; even without the implied WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see gpl-2.0.txt). If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or visit the Free Software Foundation web page, http://www.fsf.org. +# Author: Daniel Nuest (daniel.nuest@uni-muenster.de) +# Project: sos4R - visit the project web page: https://github.com/52North/sos4R +library("sos4R") + + +################################################################################ +# NOAA Center for Operational Oceanographic Products and Services (CO-OPS) +# http://oceanservice.noaa.gov/programs/coops/ +# +# CO-OPS SOS Services +# +# Related to demo "IOOS", CO-OPS' Implementation of IOOS +# +# https://geossregistries.info/geosspub/component_details_ns.jsp?compId=urn:uuid:c1af67f9-4a1b-42d2-b352-e2fdb3bcdeb1 +# request examples at http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/ +# Also good information about existing/active stations! +# +# Presentation: http://sdf.ndbc.noaa.gov/sos/IOOS_DIF_SOS_Project.ppt +# + +################################################################################ +ioosdif <- SOS(url = "http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS", + binding = "KVP") +ioosdif_off <- sosOfferings(ioosdif) +length(ioosdif_off) +# 771 + +# +sosResponseFormats(ioosdif) + +#sosObservedProperties(ioosdif_off) +unique(unlist(sosObservedProperties(ioosdif_off))) + +#CO-OPS has expanded its SOS services with an addition of the following 3 new services. +# +#High Low Tide Predictions +#Relative Humidity +#Rain Fall +# +# +#These services are offered for single station and as collections and in the following data formats; CSV, TSV. +#Please note that these services are presently available on the evaluation test site (http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos-test/). +#On January 24th, 2012 at 10:00 am EST, CO-OPS will add these new changes to our operational SOS web site (http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/). diff --git a/demo/coastlab.R b/demo/coastlab.R deleted file mode 100644 index f67a4fe..0000000 --- a/demo/coastlab.R +++ /dev/null @@ -1,125 +0,0 @@ -# Copyright (C) 2019 by 52 North Initiative for Geospatial Open Source Software GmbH, Contact: info@52north.org -# This program is free software; you can redistribute and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed WITHOUT ANY WARRANTY; even without the implied WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see gpl-2.0.txt). If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or visit the Free Software Foundation web page, http://www.fsf.org. -# Author: Daniel Nuest (daniel.nuest@uni-muenster.de) -# Project: sos4R - visit the project web page: https://github.com/52North/sos4R -library("sos4R") - - -############################################################################## -# Coastlab SOS - http://www.coastlab.org/ -# -# This SOS provides COSYNA data, see the project website at -# http://www.hzg.de/institute/coastal_research/structure/operational_systems/KOK/projects/ICON/index.html -# -# GEOSS description: -# https://geossregistries.info/geosspub/service_details_ns.jsp?serviceId=urn:uuid:b7e0c9d4-9c4a-428c-adb9-fc0efebc9798 -# -# Data disclaimer: http://www.coastlab.org/Disclaimer.html -# -# Web Portal: http://kofserver2.hzg.de/codm/ -# You can also plot the data here: http://tsdata.hzg.de/index.cgi?seite=plot_form -# -coastlab <- SOS(url = "http://kopc02.gkss.de/sos/sos.py", - binding = SosSupportedBindings()[["KVP"]]) - -# -# potentially same server? > http://sos.hzg.de/sos.py?request=GetCapabilities&service=SOS -# - -# -# potentially same server? > http://sos.hzg.de/sos.py?request=GetCapabilities&service=SOS -# - -coastlab.off <- sosOfferings(coastlab) -names(coastlab.off) - -jade1 <- coastlab.off[["Pile_Jade1"]] -sosObservedProperties(jade1) - -jade1.watertemp <- getObservation(sos = coastlab, offering = jade1, - observedProperty = list("WaterTemperature"), verbose = TRUE, - eventTime = sosCreateEventTimeList(sosCreateTimePeriod( - sos = coastlab, - begin = as.POSIXct(Sys.time() - 3600 * 24), #* 180), - end = as.POSIXct(Sys.time())))) - -# TODO continue implemenation for Coastlab SOS, problem: -# unhandled response document, it contains om:resultDefinition ... -# -# -# -# None -# Pile_Jade1 -# -# -# -# 53.516566 8.188217 -# 53.516566 8.188217 -# -# -# -# -# -# -# 2010-09-19T13:21:38 -# 2011-03-18T12:21:38 -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# 2010-09-19T13:30:00Z,53.516566,8.188217,None,14.21|2010-09-19T13:40:00Z,53.516566,8.188217,None,14.21|... -# - -# TODO create parsing function for om:resultDefinition with exchangeability feature! - -jade1.watertemp.result <- sosResult(jade1.watertemp) -summary(jade1.watertemp.result) - -################################### -# Demo finished, try another one! # -################################### diff --git a/demo/eo2heaven.R b/demo/eo2heaven.R deleted file mode 100644 index c8d4652..0000000 --- a/demo/eo2heaven.R +++ /dev/null @@ -1,243 +0,0 @@ -# Copyright (C) 2019 by 52 North Initiative for Geospatial Open Source Software GmbH, Contact: info@52north.org -# This program is free software; you can redistribute and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed WITHOUT ANY WARRANTY; even without the implied WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see gpl-2.0.txt). If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or visit the Free Software Foundation web page, http://www.fsf.org. -# Author: Daniel Nuest (daniel.nuest@uni-muenster.de) -# Edzer Pebesma (edzer.pebesma@uni-muenster.de) -# Project: sos4R - visit the project web page: https://github.com/52North/sos4R -library("sos4R") - -############################################################################### -# EO2Heaven SOS @ TU Dresden -eo2h <- SOS(url = "http://141.30.100.135:8080/eo2heavenSOS/sos") -eo2h -sosContents(eo2h) - -############################################################################### -# O2HEAVEN (Earth Observation and Environmental Modelling for the Mitigation of -# Health Risks) is a research project co-funded by the European Commission as -# part of the 7th Framework Programme (FP7) Environmental theme. -# -# It started on 1st February 2010. EO2HEAVEN contributes to a better -# understanding of the complex relationships between environmental changes and -# their impact on human health. -############################################################################### - -############################################################################### -# NOX data for Durban, South Africa -############################################################################### -offering_nox <- sosOfferings(eo2h)[["NOX"]] -sosObservedProperties(offering_nox) -sosFeaturesOfInterest(offering_nox) - -#observations_nox <- getObservation(sos = eo2h, offering = offering_nox, -# eventTime = sosCreateTime(sos = eo2h, time = "2011-01-01::2011-01-03")) -# 29 warnings, because of missing parsers: -#warnings() - -#eo2h_converters <- SosDataFieldConvertingFunctions( -# "http://www.opengis.net/def/property/OGC/0/FeatureOfInterest" = sosConvertString, -# "http://www.opengis.net/def/property/OGC/0/SamplingTime" = sosConvertTime) -# FIELDS ADDED IN VERSION 0.2-9 -#eo2h <- SOS(url = sosUrl(eo2h)) -# dataFieldConverters = eo2h_converters) - -observations_nox <- getObservation(sos = eo2h, offering = offering_nox, - inspect = TRUE, - eventTime = sosCreateTime(sos = eo2h, time = "2011-01-01::2011-01-03")) -#[sos4R] Received response (size: 56288 bytes), parsing ... -#[sos4R] Finished getObservation to http://141.30.100.135:8080/eo2heavenSOS/sos -#--> received 7 observation(s) having 315 result values [ 48, 48, 46, 41, 48, 48, 36 ]. -str(observations_nox, max.level = 5) -sosBoundedBy(observations_nox) -result_nox_bbox <- sosBoundedBy(observations_nox, bbox = TRUE) # sp ready! -plot(result_nox_bbox) - -# result extraction -result_nox <- sosResult(observations_nox) -summary(result_nox) - -observations_nox[1:2] # subsetting -result_nox_1_2 <- sosResult(observations_nox[1:2]) -summary(result_nox_1_2) -# one feature of interest per result observatoin/per member - -result_nox_1 <- sosResult(observations_nox[[1]]) -summary(result_nox_1) -names(result_nox_1) -str(observations_nox[[1]]) - - -############################################################################### -# create plot -plotStationNOX <- function(observationId, add = FALSE, colour, ...) { - .x <- sosResult(observations_nox[[observationId]])[["SamplingTime"]] - .y <- sosResult(observations_nox[[observationId]])[["NOX"]] - if(add) { - lines(x = .x, y = .y, col = colour[[observationId]], ...) - } - else { - plot(x = .x, - y = .y, - type = "l", # "b", - col = colour[[observationId]], - ..., - ) - } -} - -library("RColorBrewer") # display.brewer.all() -stations_colours <- brewer.pal(8, "Dark2") - -plotStationNOX(observationId = 1, colour = stations_colours, ylim = c(0, 120), - xlab = NA, ylab = NA) -plotStationNOX(observationId = 2, colour = stations_colours, add = TRUE) -plotStationNOX(observationId = 3, colour = stations_colours, add = TRUE) -plotStationNOX(observationId = 4, colour = stations_colours, add = TRUE) -plotStationNOX(observationId = 5, colour = stations_colours, add = TRUE) - -stations_features <- unlist(sosFeatureIds(observations_nox[1:5])) -stations_features_short <- lapply(stations_features, FUN = substring, first = 63) -title(main = paste("Features:", toString(stations_features_short)), - xlab = "sampling time", ylab = "NOX") -legend("topleft", - legend = stations_features_short, - col=stations_colours, - lty=1, lwd=1, - title="NOX Time Series") - - -############################################################################### -# Spatial data - -# spatial attributes automaticall identified -sosCoordinates(observations_nox) -# 1 line per feature, one feature per observation in the observation collection - -# R spatial data structures: package sp -library("sp") -result_nox_sp <- as(observations_nox, "SpatialPointsDataFrame") -plot(result_nox_sp) - -# -bbox(coordinates(result_nox_sp)) -#min max -#x 30.96462 31.02729 -#y -29.95696 -29.77789 - - -############################################################################### -# Plot stations on a map -library(maps); library(mapdata); library(maptools); data(worldHiresMapEnv) -crs <- sosGetCRS(eo2h)[[1]] -worldHigh <- pruneMap(map(database = "worldHires", - region = c("South Africa"), -# ylim = c(-29.957, -29.776), -# xlim = c(30.964, 31.029), - plot = FALSE)) -worldHigh_lines <- map2SpatialLines(worldHigh, proj4string = crs) - -# plot: -plot(worldHigh_lines, col = "grey50", - ylim = c(-29.97, -29.776), - xlim = c(30.964, 31.029), axes = TRUE) - -# add points to plot (stupid way, because multiple points for one location): -plot(result_nox_sp, add = TRUE, lwd = 2, pch = 21, col = "blue") -# unique(coordinates(result_nox_sp)) - -# add labels to plot: -labels_short <- lapply(sosCoordinates(observations_nox)[["feature"]], - FUN = substring, first = 63) -text(x = sosCoordinates(observations_nox)[,1], - y = sosCoordinates(observations_nox)[,2], - pos = 4, - labels = labels_short) - - -############################################################################### -# Plot stations on map with Google Maps background -library("raster"); library("dismo"); library("rgdal") - -e <- extent(c(30.8, 31.2, -29.968, -29.77)) -r <- raster(e, crs=proj4string(result_nox_sp)) -values(r) <- runif(ncell(r)) -g <- gmap(r, type = "terrain") -# ?Mercator -ptm <- spTransform(result_nox_sp, - CRS("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs")) - -# important when using StatET: Raster is not yet supported by that device -plot(g, interpolate = TRUE) #axes = TRUE) -points(ptm, col='red', pch="x", alpha=0.25, cex = 2) - -ptmLabels <- Mercator(matrix(c(sosCoordinates(observations_nox)[,"lat"], - sosCoordinates(observations_nox)[,"lon"]), ncol = 2)) -text(x = ptmLabels[,"x"], y = ptmLabels[,"y"], - pos = 4, labels = labels_short) - - -############################################################################### -# Climatology data for the state of Saxony, Germany -############################################################################### - -# TODO analysis with dresden data! -sosOfferings(eo2h)["HUMIDITY"] -sosOfferings(eo2h)["AIR_PRESSURE"] -sosOfferings(eo2h)["TEMP"] - -myTime <- sosCreateTime(sos = eo2h, time = "2003-01-01::2004-12-31") - -# get data -observations_humidity <- getObservation(sos = eo2h, - offering = "HUMIDITY", - eventTime = myTime) -observations_air_pressure <- getObservation(sos = eo2h, - offering = "AIR_PRESSURE", - eventTime = myTime) -observations_temp <- getObservation(sos = eo2h, - offering = "TEMP", - eventTime = myTime) - -# remove -999.0000 values, probably missing values -observations_temp_data <- sosResult(observations_temp) -hist(observations_temp_data[,"TEMP"]) -observations_temp_data <- subset(observations_temp_data, TEMP > -900) -summary(observations_temp_data) -dim(sosResult(observations_temp)); dim(observations_temp_data) - -observations_pressure_data <- sosResult(observations_air_pressure) -observations_pressure_data <- subset(observations_pressure_data, - AIR_PRESSURE > -900) -summary(observations_pressure_data) -hist(observations_pressure_data[,"AIR_PRESSURE"]) -dim(sosResult(observations_air_pressure)); dim(observations_pressure_data) - -observations_humidity_data <- sosResult(observations_humidity) -observations_humidity_data <- subset(observations_humidity_data, - HUMIDITY > -900) -summary(observations_humidity_data) -dim(sosResult(observations_humidity)); dim(observations_humidity_data) - -# missing values -missing_values <- data.frame( - c(dim(sosResult(observations_air_pressure))[[1]], - dim(observations_pressure_data)[[1]]), - c(dim(sosResult(observations_temp))[[1]], - dim(observations_temp_data)[[1]]), - c(dim(sosResult(observations_humidity))[[1]], - dim(observations_humidity_data)[[1]]), - row.names = c("all", "valid") -) -names(missing_values) <- c("air pressure", "temp", "humidity") -missing_values - -# percentagea -missing_values["valid",] / missing_values["all",] -# air pressure temp humidity -#valid 0.6767123 0.8599419 0.7695309 - -# barplot -barplot(as.matrix(missing_values), legend= rownames(missing_values), - beside = TRUE) - -# TODO continue with analysis - diff --git a/demo/ioos.R b/demo/ioos.R index b5e83b3..28e66d2 100644 --- a/demo/ioos.R +++ b/demo/ioos.R @@ -24,11 +24,12 @@ sosResponseFormats(ioos) ############# # first test: # !!! use sosName() of offering -getObservation(ioos, offering = sosName(ioos.off[[100]]), # verbose = TRUE +obs.test <- getObservation(ioos, offering = sosName(ioos.off[[100]]), responseFormat = "text/csv", observedProperty = sosObservedProperties(ioos.off[[100]])[1]) +obs.test -off.coords <- sosCoordinates(ioos.off) +#off.coords <- sosCoordinates(ioos.off) off.names <- sosName(ioos.off) # Plot offerings: @@ -51,9 +52,6 @@ length(ioos.procedures); length(ioos.off) # get data: # offerings in pacific? -# TODO all also the ones starting with 51, 41, 32, ... - -# TODO get all TAO/TRITON Array sensors: http://www.pmel.noaa.gov/tao/index.shtml # Terminology: http://www.pmel.noaa.gov/tao/jsdisplay/help/help_terminology_f.html # Data display: http://www.pmel.noaa.gov/tao/jsdisplay/ # Create similar plot: http://www.pmel.noaa.gov/cgi-tao/cover.cgi?P1=uwnd&P2=20110304-March-6-2011&P3=month&P4=off&script=jsdisplay/scripts/lat-lon-5day-jsd.csh @@ -70,9 +68,9 @@ phenomenon <- list("http://mmisw.org/ont/cf/parameter/sea_water_temperature") # use lapply to call getObservation for every offering with "...:wmo:52..." # possible alternative: use "all" offering: #sosName(ioos.off[[1]]) -obs.wmo52 <- lapply(X = sosName(offerings.wmo52), FUN = getObservation, #verbose = TRUE, - sos = ioos, observedProperty = phenomenon, - eventTime = last48hrs, +obs.wmo52 <- lapply(X = sosName(offerings.wmo52), FUN = getObservation, #verbose = TRUE, + sos = ioos, observedProperty = phenomenon, + eventTime = last48hrs, responseFormat = "text/csv") length(obs.wmo52) obs.wmo52[[1]] @@ -94,7 +92,7 @@ dim(obs.wmo52.all) hist(obs.wmo52.all[["sea_water_temperature (C)"]]) colnames(obs.wmo52.all) -# coordinates seem wrong and there are NA values in the +# coordinates seem wrong and there are NA values in the # data.frame, must be removed obs.wmo52.all <- obs.wmo52.all[complete.cases(obs.wmo52.all),] @@ -108,25 +106,13 @@ plot(world.lines, col = "grey50") plot(spdf, add = TRUE) -################################################################################ -# most recent observation: -obs.csv <- getObservation(ioos, offering = sosName(ioos.off[[100]]), - responseFormat = "text/csv", - observedProperty = sosObservedProperties(ioos.off[[100]])[2]) -obs.csv -summary(obs.csv) - - ################################################################################ # describe sensor: # requires SensorML 1.0.0 -ioos.get <- SOS(url = "http://sdf.ndbc.noaa.gov/sos/server.php", - binding = SosSupportedBindings()[["KVP"]], - timeFormat = "%Y-%m-%dT%H:%M:%SZ") -describeSensorOp <- sosOperation(ioos.get, sosDescribeSensorName) +describeSensorOp <- sosOperation(ioos, sosDescribeSensorName) describeSensor.outputFormat <- describeSensorOp@parameters[["outputFormat"]][[1]] ioos.procedures <- unique(unlist(sosProcedures(ioos.get))) -ioos.sensor.1.1 <- describeSensor(sos = ioos.get, procedure = ioos.procedures[[1]][[1]], +ioos.sensor.1.1 <- describeSensor(sos = ioos, procedure = ioos.procedures[[1]][[1]], outputFormat = describeSensor.outputFormat, verbose = TRUE) ioos.sensor.1.1 ioos.sensor.1.1@xml @@ -141,13 +127,14 @@ begin <- end - 3600 * 24 * 30 .offeringId <- sosId(.offering) obs.001 <- getObservation(sos = ioos, offering = sosName(.offering), # "urn:ioos:network:noaa.nws.ndbc:all" - procedure = sosProcedures(ioos.post.off[[1]])[690:700], - observedProperty = sosObservedProperties(ioos.post.off[[1]])[6:7], + procedure = sosProcedures(ioos.off[[1]])[690:700], + observedProperty = sosObservedProperties(ioos.off[[1]])[6:7], responseFormat = "text/csv", eventTime = sosCreateEventTimeList( - sosCreateTimePeriod(sos = ioos.post, begin = begin, end = end)), + sosCreateTimePeriod(sos = ioos, begin = begin, end = end)), inspect = TRUE, verbose = TRUE) +plot(x = obs.001$date_time, y = obs.001$`sea_floor_depth_below_sea_surface (m)`) ################################################################################ # KML @@ -155,22 +142,9 @@ kml <- getObservation(ioos, offering = "urn:ioos:network:noaa.nws.ndbc:all", # verbose = TRUE, # saveOriginal = TRUE, responseFormat = "application/vnd.google-earth.kml+xml", - observedProperty = list( - "http://mmisw.org/ont/cf/parameter/air_temperature")) + observedProperty = list("http://mmisw.org/ont/cf/parameter/air_temperature")) kml -# TODO do sth. with the KML, e.g. export using examples from Spatial-Analyst? -# TODO use plotKML to create an output? - - -################################################################################ -# GET -ioos.get <- SOS(url = "http://sdf.ndbc.noaa.gov/sos/server.php", - binding = SosSupportedBindings()[["KVP"]], - timeFormat = "%Y-%m-%dT%H:%M:%SZ") -# parsers = SosParsingFunctions("GetObservation" = parseNoParsing) - - ################################### # Demo finished, try another one! # ################################### diff --git a/demo/marinemeta.R b/demo/marinemeta.R deleted file mode 100644 index d985131..0000000 --- a/demo/marinemeta.R +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2019 by 52 North Initiative for Geospatial Open Source Software GmbH, Contact: info@52north.org -# This program is free software; you can redistribute and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed WITHOUT ANY WARRANTY; even without the implied WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see gpl-2.0.txt). If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or visit the Free Software Foundation web page, http://www.fsf.org. -# Author: Daniel Nuest (daniel.nuest@uni-muenster.de) -# Project: sos4R - visit the project web page: https://github.com/52North/sos4R -library("sos4R") - - -############################################################################## -# OOSTethys SOS # -# http://www.oostethys.org/development/web-services/web-services-summary # -############################################################################## -# Sensor Observation Service (SOS) for Marine Metadata Interoperability -# Initiative (MMI) # Using GET works! - -# add converter for UOM C and others (which is not a valid unit) -myConverters <- SosDataFieldConvertingFunctions( - # mapping for UOM: - "C" = sosConvertDouble, - "S/m" = sosConvertDouble, - # mapping for definition: - "http://mmisw.org/ont/cf/parameter/sea_water_salinity" = sosConvertDouble) -MBARI <- SOS("http://mmisw.org/oostethys/sos", binding = "KVP", - dataFieldConverters = myConverters) - -myOff <- sosOfferings(MBARI)[[1]] -myProc <- sosProcedures(MBARI)[[1]] - -mbariObs <- getObservation(sos = MBARI, offering = myOff, procedure = myProc) - -# explore data -data <- sosResult(mbariObs) # just one Observation in ObservationCollection, which is returned directly -cat("\nFirst lines of data:\n") -print(data[1:3,]) -cat("\nMetadata attributes of one value:\n") -print(attributes(data$Temperature)) -#str(data) - -cat("\nCovariance of Temperature Conductivity Salinity:\n") -tcs.cov <- cov(data[, 5:7]) -print(tcs.cov) -cat("\nCorrelation of Temperature Conductivity Salinity:\n") -tcs.cor <- cor(data[, 5:7]) -print(tcs.cor) - -# quick plot -plot(data) -par(ask = TRUE) -plot(data[,c("Temperature", "Salinity", "Conductivity")], - main = "MBARI MMI SOS", - sub = "OOSTethys Sensor Observation Service") - -cat("\nExpect a warning here because of incomplete swe:Quantitiy.\n") - -################################### -# Demo finished, try another one! # -################################### diff --git a/demo/oceanwatch.R b/demo/oceanwatch.R deleted file mode 100644 index 7808553..0000000 --- a/demo/oceanwatch.R +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (C) 2019 by 52 North Initiative for Geospatial Open Source Software GmbH, Contact: info@52north.org -# This program is free software; you can redistribute and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed WITHOUT ANY WARRANTY; even without the implied WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see gpl-2.0.txt). If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or visit the Free Software Foundation web page, http://www.fsf.org. -# Author: Daniel Nuest (daniel.nuest@uni-muenster.de) -# Project: sos4R - visit the project web page: https://github.com/52North/sos4R -library("sos4R") - -############################################################################## -# Oceanwatch -# http://las.pfeg.noaa.gov/oceanWatch/oceanwatch.php -oceanwatch <- SOS(url = "http://oceanwatch.pfeg.noaa.gov/pysos/sos_mysql2.py", - binding = SosSupportedBindings()[["KVP"]]) -# warnings about missing response modes for offerings -warnings() - -ocean.off <- sosOfferings(oceanwatch) -names(ocean.off) - -ocean.proc <- sosProcedures(oceanwatch) -ocean.proc - -ocean.obsProp <- sosObservedProperties(oceanwatch) -ocean.obsProp - -sosCapabilitiesDocumentOriginal(oceanwatch) -# OK, but missing elements - -describeSensor(oceanwatch, ocean.proc[[4]], inspect = TRUE) -# fails - -lapply(X = ocean.off, FUN = getObservation, sos = oceanwatch) -# Es gab 36 Warnungen (Anzeige mit warnings()) - -length(ocean.off) -# 36 - -# -> SOS seems empty - -# TODO - -################################### -# Demo finished, try another one! # -################################### diff --git a/demo/pegel.R b/demo/pegel.R index 850d0a2..38071c9 100644 --- a/demo/pegel.R +++ b/demo/pegel.R @@ -9,7 +9,8 @@ library("quantreg") ############################################################################## # PegelOnlineSOS -pegelsos <- SOS(url = "http://pegelonline.wsv.de/webservices/gis/gdi-sos") +pegelsos <- SOS(url = "http://pegelonline.wsv.de/webservices/gis/gdi-sos", + version = "1.0.0") pegelsos @@ -29,7 +30,6 @@ print(baken) wasserstand_roh <- sosOfferings(pegelsos)[["WASSERSTAND_ROHDATEN"]] # what? wasserstand <- sosObservedProperties(wasserstand_roh)[1] -# PROBLEM: order of result list is not alswas the same! # must be "Wasserstand": # when? @@ -71,7 +71,7 @@ range(r2$Wasserstand) r2clean <- subset(r2, Wasserstand > 0) range(r2clean$Wasserstand) -plot(r1clean$SamplingTime, r1clean$Wasserstand, type = "l", ylim=c(200,800), +plot(r1clean$SamplingTime, r1clean$Wasserstand, type = "l", ylim = c(200,800), lty = "solid", col = "blue", main = paste("Water level at", sosProcedures(pegelObs[c(1,2)]))) lines(r2clean$SamplingTime, r2clean$Wasserstand, type = "l", col = "orange", @@ -81,7 +81,7 @@ par(ask = TRUE) # Plot a quantile regression line with standard error bounds, using the quantreg package. r1plot <- xyplot(r1clean$Wasserstand ~ r1clean$SamplingTime, r1clean, type = "l", - col = "orange", main = paste0(sosProcedures(pegelObs[[1]]), + col = "orange", main = paste0(sosProcedures(pegelObs[[1]]), " with quantile regression line and error bounds"), xlab = "Time", ylab = "Water level") diff --git a/demo/southesk.R b/demo/southesk.R deleted file mode 100644 index ec94f8f..0000000 --- a/demo/southesk.R +++ /dev/null @@ -1,400 +0,0 @@ -# Copyright (C) 2019 by 52 North Initiative for Geospatial Open Source Software GmbH, Contact: info@52north.org -# This program is free software; you can redistribute and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed WITHOUT ANY WARRANTY; even without the implied WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see gpl-2.0.txt). If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or visit the Free Software Foundation web page, http://www.fsf.org. -# Author: Daniel Nuest (daniel.nuest@uni-muenster.de) -# Project: sos4R - visit the project web page: https://github.com/52North/sos4R -library("sos4R") - -################################################################################ -# SOS @ CSIRO -# The South Esk test bed -cat("Go to the following website for details of the South Esk Hydrological Sensor Web - Tasmania, Australia: ", - "http://www.csiro.au/sensorweb/au.csiro.OgcThinClient/OgcThinClient.html") - -# Data subject to CSIRO's legal disclaimer: http://www.csiro.au/org/LegalNoticeAndDisclaimer.html - -# See also: -# http://external.opengis.org/twiki_public/bin/view/ClimateChallenge2009/ServiceOfferingCSIRO -# www.csiro.au/sensorweb2/catalog/setup/ --> a catalog with the SOS urls! - -csiro <- SOS("http://www.csiro.au/sensorweb/CSIRO_SOS/sos", version = sos200_version) - -################################################################################ -# TIME FORMAT ISSUES -################################################################################ -#?Sys.timezone -Sys.timezone() -strptime("1995-05-25T15:30:00+11:00", format = "%Y-%m-%dT%H:%M:%OS")$isdst -# 1 -strptime("1995-05-25T15:30:00+11:00", format = "%Y-%m-%dT%H:%M:%OS%z")$isdst -# -1 -# isdst: Daylight Savings Time flag. Positive if in force, zero if not, negative if unknown. - -######################################### -# This does not work on windows machines: the %z does not work for numerical -# outputs, so the create time string is never suitable and the timeFormat -# parameter cannot solve the problem. - -# Try fixing with locale... -#Sys.getlocale(category = "LC_TIME") -#Sys.setlocale("LC_ALL", "English") -#Sys.getlocale() -#Sys.setenv(TZ="GMT") -# All this does NOT remove the "Mitteleurop_ische Zeit" from the strftime output!! - -################################################################################ -# REPLACE TIME CONVERTER -csiroTimeConverter = function(x, sos) { -# cat("Using adapted time parser for ", toString(x), "\n") - .x <- paste (x, "00", sep = "") - .value <- sosConvertTime(.x, sos = sos) - return(.value) -} -# works: -#> csiroTimeConverter("2011-10-06T14:35:00+11", csiro) -#Using adapted time parser for 2011-10-06T14:35:00+11 -#[1] "2011-10-06 05:35:00 CEST" - -# Ignore time zone when parsing, but use when creating output: -strftime(strptime("1995-05-25T15:30:00+11:00", format = sosDefaultTimeFormat), - format = paste(sosDefaultTimeFormat, "%z", sep ="")) -# Problem: Output is "1995-05-25T15:30:00Mitteleurop_ische Sommerzeit", not numerical! - -################## -# REQUIRED OUTPUT (detected manually based on capabilities): -# 2011-10-06T10:28:10+11:00 - -################################################################################ -# REPLACE only POSIXt encoder with a hack! -testtime <- strptime("2011-10-06T14:35:00+11", format = sosDefaultTimeFormat) -# returns POSIXlt - good. -strftime(testtime, format = sosDefaultTimeFormat) -format(testtime, format = sosDefaultTimeFormat) - -setMethod(f = "encodeXML", - signature = signature(obj = "POSIXt", sos = "SOS"), - definition = function(obj, sos, verbose) { - if(verbose) cat("CSIRO encoding... ") - - # time zone hack! - .time <- obj + 11 * 60 * 60 # add 11 hours - .formatted <- strftime(x = .time, format = sosTimeFormat(sos)) - .formatted <- paste(.formatted, "+11:00", sep = "") # append 11:00 - - if(verbose) - cat("Formatted ", toString(obj), " to ", .formatted, "\n") - - return(.formatted) - } -) - -# CSIRO (orange, purple on map), replace testing one from above! -csiro <- SOS("http://www.csiro.au/sensorweb/CSIRO_SOS/sos", - dataFieldConverters = SosDataFieldConvertingFunctions( - "urn:ogc:data:time:iso8601" = csiroTimeConverter, - "urn:ogc:def:phenomenon:OGC:rainfall" = sosConvertDouble), - switchCoordinates = TRUE) - -# Bureau of Meteorology (red and dark blue on map) -bom <- SOS("http://www.csiro.au/sensorweb/BOM_SOS/sos", - dataFieldConverters = SosDataFieldConvertingFunctions( - "urn:ogc:data:time:iso8601" = csiroTimeConverter, - "urn:ogc:def:phenomenon:OGC:rainfall" = sosConvertDouble), - switchCoordinates = TRUE, # verbose = TRUE -) -sosTimeFormat(bom) -sosOfferings(bom)[[1]] - -# Tasmania Department of Primary Industries, Parks, Wildlife and Environment (DPIPWE, white on map) -dpiw <- SOS("http://www.csiro.au/sensorweb/DPIW_SOS/sos?Service=SOS&Request=GetCapabilities", switchCoordinates = TRUE) - -# Hydro Tasmania Consulting - Remote Monitoring and Investigation Unit (yellow on map) -ht <- SOS("http://www.csiro.au/sensorweb/HT_SOS/sos") - -# Forestry Tasmania - Fire Risk Management Branch (green on map) -forestry <- SOS("http://www.csiro.au/sensorweb/Forestry_SOS/sos") - -# Tasmania Department of Primary Industries, Parks, Wildlife and Environment (DPIPWE) - Water Assessment Branch -dpipwe <- SOS("http://www.csiro.au/sensorweb/DPIPWE_SOS/sos") - -# What about these? -#hutchins <- SOS("http://150.229.66.73/HutchinsSOS/sos") -#elliotwsn <- SOS("http://150.229.66.73/ElliotWSNSOS/sos") - - -################################################################################ -# explore SOSs with plots - -################################################################################ -# plot two SOS with background map -crs <- sosGetCRS(csiro) - -library(maps) -library(maptools) -world <- pruneMap(map(database = "world", region = "Australia:Tasmania", - plot = FALSE)) -world.lines <- map2SpatialLines(world, proj4string = crs[[2]]) -plot(world.lines, col = "grey50") -plot(csiro, add = TRUE, lwd = 3, lty = 1) -plot(bom, add = TRUE, - border.color.pal = sosDefaultColorPalette[[length(sosOfferings(csiro))]], - lwd = 3, lty = 3) - -# plot labels -labelCoords <- rbind(sosCoordinates(sosOfferings(csiro)), - sosCoordinates(sosOfferings(bom))) -labels <- c(sosName(sosOfferings(csiro)), sosName(sosOfferings(bom))) -text(labels = labels, col = sosDefaultColorPalette, - x = labelCoords[,1], - y = labelCoords[,2]) -title(main = paste(sosTitle(csiro), "and", sosTitle(bom)), - sub = paste(sosAbstract(csiro), "\n", sosAbstract(bom))) - -################################################################################ -# plot one offering with high resolution background map and cities, including -# map axes and scale -off <- sosOfferings(csiro)[[2]] -library(mapdata) -data(worldHiresMapEnv) - -# detect region automatically -region <- map.where(database = "worldHires", sosCoordinates(off)) -worldHigh <- pruneMap(map(database = "worldHires", region = region, - plot = FALSE)) -worldHigh_Lines <- map2SpatialLines(worldHigh, proj4string = crs[[2]]) - -plot(worldHigh_Lines, col = "grey50") -data(world.cities) -map.cities(label = TRUE, pch = 19, col = "black") - -plot(off, add = TRUE, border = "red", lwd = 3) -title(main = paste("Offering with ID '", sosId(off), "'", sep = ""), - sub = paste("Features:", toString(sosFeaturesOfInterest(off)))) - -map.axes() -map.scale(metric = TRUE, ratio = FALSE) - - -################################################################################ -# Data request and consolidation based on three SOS: bom, csiro and dpiw - -# phenomenon rainfall or rainfalltoday is available at all stations -rainfall <- "urn:ogc:def:phenomenon:OGC:rainfall" - -lastDay <- sosCreateTimePeriod(sos = bom, begin = (Sys.time() - 3600 * 24), - end = Sys.time()) -sosTimeFormat(bom); encodeXML(lastDay, bom) -str(lastDay) - -##### -# bom -# -rainfall.off.bom <- sosOfferings(bom)[["BOM Offering"]] -phenomenon.bom <- as.list(unlist(sosObservedProperties(bom))) -phenomenon.bom <- phenomenon.bom[grep(pattern = "rain", phenomenon.bom)] - -rainfall.obs.bom <- getObservation(sos = bom, offering = rainfall.off.bom, - observedProperty = phenomenon.bom, verbose = TRUE, - eventTime = sosCreateEventTimeList(lastDay)) -rainfall.result.bom <- sosResult(rainfall.obs.bom, coordinate = TRUE) -summary(rainfall.result.bom) - -######################## -# csiro, ht and datacell -# -rainfall.off.csiro <- sosOfferings(csiro)[["Rain Gauges"]] -rainfall.off.ht <- sosOfferings(csiro)[["HT Weather Stations"]] -rainfall.off.datacell <- sosOfferings(csiro)[["Datacall Weather Stations"]] - -procedures.csiro <- sosProcedures(rainfall.off.csiro) -phenomenon.csiro <- sosObservedProperties(rainfall.off.csiro) -phenomenon.csiro <- phenomenon.bom[grep(pattern = "rain", phenomenon.csiro)] -print(paste("FOIs: ", toString(sosFeaturesOfInterest(rainfall.off.csiro)))) - -rainfall.obs.csiro <- getObservation(sos = csiro, # verbose = TRUE, - offering = rainfall.off.csiro, - procedure = procedures.csiro, - observedProperty = phenomenon.csiro, - eventTime = sosCreateEventTimeList(lastDay)) -# at this point realized problem with parsing time (just NAs), need to fix it -# with csiroTimeParser (see above) - -phenomenon.ht <- sosObservedProperties(rainfall.off.ht) -phenomenon.ht <- phenomenon.ht[grep(pattern = "rain", phenomenon.ht)] -rainfall.obs.ht <- getObservation(sos = csiro, # verbose = TRUE - offering = rainfall.off.ht, - observedProperty = phenomenon.ht, - eventTime = sosCreateEventTimeList(lastDay)) - -phenomenon.dc <- sosObservedProperties(rainfall.off.datacell) -phenomenon.dc <- phenomenon.dc[grep(pattern = "rainfalltoday", phenomenon.dc)] -rainfall.obs.dc <- getObservation(sos = csiro, # verbose = TRUE - offering = rainfall.off.datacell, - observedProperty = phenomenon.dc, - eventTime = sosCreateEventTimeList(lastDay)) - -# get data values -rainfall.result.csiro <- sosResult(rainfall.obs.csiro, coordinate = TRUE) -summary(rainfall.result.csiro) - -rainfall.result.ht <- sosResult(rainfall.obs.ht, coordinate = TRUE) -summary(rainfall.result.ht) - -#crs.ht <- sosGetCRS(rainfall.obs.ht[[1]]) -rainfall.result.dc <- sosResult(rainfall.obs.dc, coordinate = TRUE) -summary(rainfall.result.dc) - -################################################################################ -# Data consolidation: -# save all data in analyzable data structure for one point in time. - -# Times do not match exactly: -#time.csiro <- rainfall.result.csiro[,"Time"] -#time.ht <- rainfall.result.ht[,"Time"] -#time.dc <- rainfall.result.dc[,"Time"] -#time.bom <- rainfall.result.bom[,"Time"] - -# -# subset data for one point in time -# -rainfall.data.time.bom <- unique(rainfall.result.bom[,"Time"])[[1]] -rainfall.data.bom <- subset(rainfall.result.bom, - Time == rainfall.data.time.bom, - c("lat", "lon", "feature", "urn:ogc:def:phenomenon:OGC:rainfall")) -rainfall.data.bom <- cbind(rainfall.data.bom, offering = c("bom")) - -rainfall.data.time.csiro <- unique(rainfall.result.csiro[,"Time"])[[1]] -rainfall.data.csiro <- subset(rainfall.result.csiro, - Time == rainfall.data.time.csiro, - c("lat", "lon", "feature", "urn:ogc:def:phenomenon:OGC:rainfall")) -rainfall.data.csiro <- cbind(rainfall.data.csiro, offering = c("csiro")) - -# some error here, remove for now -#rainfall.data.time.ht <- unique(rainfall.result.ht[,"Time"])[[1]] -#rainfall.data.ht <- subset(rainfall.result.ht, -# Time == rainfall.data.time.ht, -# c("lat", "lon", "feature", "urn:ogc:def:phenomenon:OGC:rainfall")) -#rainfall.data.ht <- cbind(rainfall.data.ht, offering = c("ht")) - -rainfall.data.time.dc <- unique(rainfall.result.dc[["Time"]])[[1]] -rainfall.data.dc <- subset(rainfall.result.dc, - Time %in% rainfall.data.time.dc, - c("lat", "lon", "feature", "urn:ogc:def:phenomenon:OGC:rainfalltoday")) -names(rainfall.data.dc) <- c(names(rainfall.data.dc)[c(1,2,3)], - "urn:ogc:def:phenomenon:OGC:rainfall") -rainfall.data.dc <- cbind(rainfall.data.dc, offering = c("dc")) - -# -# Bind data frames together -# -rainfall.data <- rbind(rainfall.data.bom, - rainfall.data.csiro, -# rainfall.data.ht, - rainfall.data.dc) -names(rainfall.data) <- list("lat", "lon", "feature", "rainfall", "offering") -summary(rainfall.data) -# see offering! - -# Create SpatialPointsDataFrame, use just the CRS of one observation -crs <- sosGetCRS(rainfall.obs.csiro)[[2]] -rainfall.spdf <- SpatialPointsDataFrame( - coords = rainfall.data[,c("lon", "lat")], - data = rainfall.data[,c("feature", "rainfall", "offering")], - proj4string = crs) -str(rainfall.spdf) -bbox(rainfall.spdf) -summary(rainfall.spdf) - -cat("Please be aware that the times that are combined in the following are NOT equal!\n") -cat(paste("BOM:\t", toString(rainfall.data.time.bom), "\n"), - paste("CSIRO:\t", toString(rainfall.data.time.csiro), "\n"), -# paste("HT:\t", toString(rainfall.data.time.ht), "\n"), - paste("DC:\t", toString(rainfall.data.time.dc), "\n")) - - -################################################################################ -# plot stations with background data -library("maps") -library("sp") -library("rgdal") # for spTransform -library("maptools") # for pruneMap -library("mapdata") - -world.p <- pruneMap( - map(database = "worldHires", region = "Australia:Tasmania", - plot = FALSE)) -world.sp <- map2SpatialLines(world.p, proj4string = crs) -plot(x = world.sp, col = "grey", main = "Rainfall Tasmania") -plot(rainfall.spdf, add = TRUE) - -#text(x = coordinates(rainfall.spdf)[,"lat"], -# y = coordinates(rainfall.spdf)[,"lon"], -# labels = rainfall.spdf@data[, "feature"], adj = c(0, 1), cex = 0.75) -text(x = coordinates(rainfall.spdf)[,"lon"], - y = coordinates(rainfall.spdf)[,"lat"], col = "blue", - labels = rainfall.spdf@data[,"offering"], adj = c(1, 0), cex = 0.75) -title(main = paste("Observation locations of", sosTitle(csiro)), - sub = paste(sosAbstract(csiro))) - -# inspect and plot data -summary(rainfall.spdf[,"rainfall"]) -hist(rainfall.spdf@data[,"rainfall"], main = "Rainfall") -bubble(rainfall.spdf, zcol = 2, maxsize = 2, col = c("#ff5588", "#ff5588"), - main = "Rainfall in Tasmania", do.sqrt = TRUE) - -################################################################################ -# transform to UTM for kriging and background map -utm55 = CRS("+proj=utm +zone=55 +datum=WGS84") -bgmap = map2SpatialLines(map("worldHires", region = "Australia:Tasmania", - plot=F)) -proj4string(bgmap) <- "+proj=longlat +datum=WGS84" -bgmap.utm <- spTransform(bgmap, utm55) -rainfall.spdf.utm = spTransform(x = rainfall.spdf, CRSobj = utm55) -# error with spTransform, it makes all coordinates the same! -plot(bgmap.utm, col = "grey") -plot(rainfall.spdf.utm, add = TRUE) - -################################################################################ -# Intamap -#library("intamap") -#one.intamap <- one.spdf -#names(one.intamap) <- list("feature", "value") -# -#obj <- createIntamapObject(observations = one.intamap, -# targetCRS = crs.csiro) -#checkSetup(obj) -# less than 20 observations, not able to perfrom interpolation - -################################################################################ -# automap -library("automap") -# Ordinary kriging, no new_data object -kriging_result = autoKrige( - log(rainfall.spdf[["rainfall"]])~1, - input_data = rainfall.spdf, - new_data = SpatialPixels( - SpatialPoints(makegrid(rainfall.spdf, n = 300)))) -plot(kriging_result) - -################################################################################ -# Kriging -library("gstat") -rainfall.grid.utm = SpatialPixels( - SpatialPoints(makegrid(rainfall.spdf.utm, n = 300), - proj4string = utm55)) -m <- vgm(.59, "Sph", 874, .04) -# ordinary kriging: -x <- krige(log(rainfall.spdf[["rainfall"]])~1, - rainfall.spdf.utm, rainfall.grid.utm, model = m) -spplot(x["var1.pred"], main = "ordinary kriging predictions") -spplot(one.utm, add = TRUE) - -spplot(x["var1.var"], main = "ordinary kriging variance") - -################################################################################ -# spacetime -# TODO continue analysis with spacetime package or make a forecast -# See http://robjhyndman.com/researchtips/forecast3/ - -################################### -# Demo finished, try another one! # -################################### From 66c1a6d159fd0bb693f50d9a65678040087b5d0b Mon Sep 17 00:00:00 2001 From: nuest Date: Fri, 12 Apr 2019 19:04:44 +0200 Subject: [PATCH 03/13] fix CSV, closes #124 --- R/SOS-methods-parsing.R | 8 +++++--- R/SOS-methods-util.R | 21 +++++++++++++-------- R/SOS-methods.R | 6 +++++- tests/testthat/test_getobservation.R | 14 ++++++++++++++ tests/testthat/test_utils.R | 19 +++++++++++++++++++ 5 files changed, 56 insertions(+), 12 deletions(-) diff --git a/R/SOS-methods-parsing.R b/R/SOS-methods-parsing.R index 915d6d9..1a9acca 100644 --- a/R/SOS-methods-parsing.R +++ b/R/SOS-methods-parsing.R @@ -485,12 +485,14 @@ setMethod(f = "parseFile", } ) -# -# parse commma seperated values ---- -# parseCSV <- function(obj, verbose = FALSE) { if (verbose) cat("[parseCSV] Processing CSV...\n") + if (inherits(x = obj, what = "data.frame")) { + if (verbose) cat("[parseCSV] Already a data.frame, returning object\n") + return(obj) + } + .lines <- strsplit(x = obj, split = "\n")[[1]] .data <- do.call(what = "strsplit", args = list(.lines, split = ",")) diff --git a/R/SOS-methods-util.R b/R/SOS-methods-util.R index 2fb9fc2..54c9cca 100644 --- a/R/SOS-methods-util.R +++ b/R/SOS-methods-util.R @@ -380,15 +380,20 @@ setMethod(f = "sosGetCRS", definition = function(obj, verbose = FALSE) { if (verbose) cat("[sosGetCRS] from '", obj, "'\n", sep = "") - # get the position of EPSG code - .split <- strsplit(as.character(obj), split = ":") - .idx <- which(toupper(.split[[1]]) == "EPSG") - if (length(.idx) == 0) { - # possibly versioned, try one index higher? - warning(paste("Could not create CRS from the given object:", obj)) - return(NULL) + .epsg <- NA + # URN + if (grepl(pattern = "urn:ogc:def:crs", x = obj)) { + .epsg <- sub(pattern = "(.*)EPSG:[0-9]*(:?)", replacement = "", x = obj)[[1]] + } + # URL + if (grepl(pattern = "opengis.net", x = obj)) { + .epsg <- sub(pattern = "(.*)EPSG/[0-9]*(/?)", replacement = "", x = obj)[[1]] + } + + if (is.na(.epsg)) { + warning("Could not create CRS from string ", obj) + return(NA) } - .epsg <- .split[[1]][[length(.split[[1]])]] .initString <- paste("+init=epsg", .epsg, sep = ":") diff --git a/R/SOS-methods.R b/R/SOS-methods.R index 93132f5..5a4d519 100644 --- a/R/SOS-methods.R +++ b/R/SOS-methods.R @@ -1514,10 +1514,14 @@ setMethod(f = "checkRequest", xml <- xml2::read_xml(text) return(xml) } - else if (contentType == "application/xml") { + else if (contentType == "application/xml" || contentType == "text/xml") { xml <- httr::content(x = response, encoding = sosDefaultCharacterEncoding) return(xml) } + else if (contentType == "text/csv") { + tibble <- httr::content(x = response, encoding = sosDefaultCharacterEncoding) + return(tibble) + } stop("Unsupported content type in response") } diff --git a/tests/testthat/test_getobservation.R b/tests/testthat/test_getobservation.R index 96477de..247f7ea 100644 --- a/tests/testthat/test_getobservation.R +++ b/tests/testthat/test_getobservation.R @@ -124,3 +124,17 @@ test_that("POX", { expect_equal(dim(result), c(71, 2)) expect_named(result, c("phenomenonTime", "AirTemperature")) }) + +test_that("CSV parsing works", { + skip_on_cran() + + ioos <- SOS(url = "https://sdf.ndbc.noaa.gov/sos/server.php", + timeFormat = "%Y-%m-%dT%H:%M:%SZ") + ioos.off <- sosOfferings(ioos) + obs <- getObservation(ioos, offering = sosName(ioos.off[[100]]), + responseFormat = "text/csv", + observedProperty = sosObservedProperties(ioos.off[[100]])[1]) + obs + expect_s3_class(obs, "data.frame") + expect_equal(dim(obs), c(1, 7)) +}) diff --git a/tests/testthat/test_utils.R b/tests/testthat/test_utils.R index 442b6c2..6649fd0 100644 --- a/tests/testthat/test_utils.R +++ b/tests/testthat/test_utils.R @@ -46,3 +46,22 @@ test_that("addional KVPs are concatenated correctly", { actual <- list("this" = "is", "working" = "correctly") expect_equal(.encodeAdditionalKVPs(actual), expected) }) + + +test_that("can get CRS from URN", { + obj <- sosGetCRS("urn:ogc:def:crs:EPSG::4326") + expect_s4_class(obj, "CRS") + expect_match(obj@projargs, "init=epsg:4326") +}) + +test_that("can get CRS from URN with version", { + obj <- sosGetCRS("urn:ogc:def:crs:EPSG:99:4326") + expect_s4_class(obj, "CRS") + expect_match(obj@projargs, "init=epsg:4326") +}) + +test_that("can get CRS from URL", { + obj <- sosGetCRS("http://www.opengis.net/def/crs/EPSG/0/4326") + expect_s4_class(obj, "CRS") + expect_match(obj@projargs, "init=epsg:4326") +}) From dbe462fa1b8da798413b2d08bec18d13b8c55787 Mon Sep 17 00:00:00 2001 From: nuest Date: Fri, 12 Apr 2019 19:05:34 +0200 Subject: [PATCH 04/13] update authors file to include 52N as copyright holder also improve title and remove Maintainer and Author fields, they are generated from Authors@R --- DESCRIPTION | 38 +++++++++++++++++++++++++------------- DEV-README.md | 15 ++++++++++++++- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index dccfbee..17c0641 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,19 +1,31 @@ Package: sos4R Type: Package -Title: An R Client for the OGC Sensor Observation Service +Title: Client for the OGC Sensor Observation Service Version: 0.3.0 -Authors@R: c(person(given = "Daniel", family = "Nuest", role = c("cre", "aut"), - email = "daniel.nuest@uni-muenster.de", comment = c(ORCID = "0000-0002-0024-5046")), - person("Edzer", "Pebesma", role = "ctb", comment = c(ORCID = "0000-0001-8049-7069")), - person("Ben", "Graeler", role = "ctb", comment = c(ORCID = "0000-0001-5443-4304")), - person("Benjamin", "Pross", role = "ctb"), - person("Eike Hinderk", "Juerrens", role = "ctb")) -Author: Daniel Nuest [cre, aut] (), - Edzer Pebesma [ctb] (), - Ben Graeler [ctb] (), - Benjamin Pross [ctb], - Eike Hinderk Juerrens [ctb] -Maintainer: Daniel Nuest +Date: 2019-04-12 +Authors@R: + c(person(given = "Daniel", + family = "Nuest", + role = c("cre", "aut"), + email = "daniel.nuest@uni-muenster.de", + comment = c(ORCID = "0000-0002-0024-5046")), + person(given = "Edzer", + family = "Pebesma", + role = "ctb", + comment = c(ORCID = "0000-0001-8049-7069")), + person(given = "Ben", + family = "Graeler", + role = "ctb", + comment = c(ORCID = "0000-0001-5443-4304")), + person(given = "Benjamin", + family = "Pross", + role = "ctb"), + person(given = "Eike Hinderk", + family = "Juerrens", + role = "ctb"), + person(given = "52°North Initiative for Geospatial Open Source Software GmbH", + email = "info@52north.org", + role = "cph")) Depends: R (>= 3.4.0) Imports: httr, diff --git a/DEV-README.md b/DEV-README.md index c01c19b..710ddfe 100644 --- a/DEV-README.md +++ b/DEV-README.md @@ -237,9 +237,11 @@ Add tests. A new release shall be uploaded to CRAN after testing and under the following procedure: +- Install the current version of the package from source - Run the [tests](#tests) locally and resolve all problems - Run a check locally, e.g. `devtools::check(document = FALSE)` and fix errors, warnings, and notes -- Update NEWS file based on latest commits +- Update NEWS file based on latest commits, add missing changes/updates/notable things +- Update the `Date` field in the `DESCRIPTION` file to match the release date - Create a PR from `dev` to `master` and check the CI status, fix all problems - https://travis-ci.org/52North/sos4R - https://ci.appveyor.com/project/52North/sos4r @@ -256,6 +258,17 @@ A new release shall be uploaded to CRAN after testing and under the following pr - Create a git tag with the version number using the letter `v` followed by the version number (see above, must match `DESCRIPTION`), e.g. `v1.2.3`, and push it to the main repository - Read and follow http://cran.r-project.org/web/packages/policies.html and http://r-pkgs.had.co.nz/release.html#release-check again, make necessary changes - Merge the PR +- Update your local `master` to upstream's `master` branch +- Create a git tag with the version number using the letter `v` followed by the version number (see above, must match `DESCRIPTION`), e.g. `v1.2.3`, and push it to the main repository +- Create a release on GitHub based on the new tag, named just as the version tag +-_ Do the actual release_ with `devtools::release()` (which will ask you again if you did many of the steps before) +- Wait for the good news, check where the package is in the queue with `foghorn::cran_incoming(pkg = "sos4R")` +- When available on CRAN: + - Checkout the `dev` branch + - Merge `upstream/master` + - Update the version in `DESCRIPTION` to a new development version, e.g. from `0.3.0` to `0.4.0.9000` + - Email on 52N mailing list(s) (coordinate with 52N staff) + - Tweet You can then do the actual release with From dba72ac238987b8bf290ae8bc95b60bcc66955d2 Mon Sep 17 00:00:00 2001 From: nuest Date: Fri, 12 Apr 2019 19:29:50 +0200 Subject: [PATCH 05/13] support lowercase URNs for CRS def --- R/SOS-methods-util.R | 10 +++++++--- tests/responses/Capabilities_Mapserver.xml | 2 +- tests/testthat/test_utils.R | 7 ++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/R/SOS-methods-util.R b/R/SOS-methods-util.R index 54c9cca..bc68488 100644 --- a/R/SOS-methods-util.R +++ b/R/SOS-methods-util.R @@ -382,12 +382,16 @@ setMethod(f = "sosGetCRS", .epsg <- NA # URN - if (grepl(pattern = "urn:ogc:def:crs", x = obj)) { - .epsg <- sub(pattern = "(.*)EPSG:[0-9]*(:?)", replacement = "", x = obj)[[1]] + if (grepl(pattern = "urn:ogc", x = obj)) { + .epsg <- sub(pattern = "(.*)epsg:[0-9]*(:?)", + replacement = "", + x = tolower(obj))[[1]] } # URL if (grepl(pattern = "opengis.net", x = obj)) { - .epsg <- sub(pattern = "(.*)EPSG/[0-9]*(/?)", replacement = "", x = obj)[[1]] + .epsg <- sub(pattern = "(.*)epsg/[0-9]*(/?)", + replacement = "", + x = tolower(obj))[[1]] } if (is.na(.epsg)) { diff --git a/tests/responses/Capabilities_Mapserver.xml b/tests/responses/Capabilities_Mapserver.xml index d6d078b..c2b5cc2 100644 --- a/tests/responses/Capabilities_Mapserver.xml +++ b/tests/responses/Capabilities_Mapserver.xml @@ -232,7 +232,7 @@ Water EPSG:4326 - + -141.000000 42.000000 -52.000000 84.000000 diff --git a/tests/testthat/test_utils.R b/tests/testthat/test_utils.R index 6649fd0..8b1dcfd 100644 --- a/tests/testthat/test_utils.R +++ b/tests/testthat/test_utils.R @@ -47,13 +47,18 @@ test_that("addional KVPs are concatenated correctly", { expect_equal(.encodeAdditionalKVPs(actual), expected) }) - test_that("can get CRS from URN", { obj <- sosGetCRS("urn:ogc:def:crs:EPSG::4326") expect_s4_class(obj, "CRS") expect_match(obj@projargs, "init=epsg:4326") }) +test_that("can get CRS from lowercase URN", { + obj <- sosGetCRS("urn:ogc:def:crs:epsg::4326") + expect_s4_class(obj, "CRS") + expect_match(obj@projargs, "init=epsg:4326") +}) + test_that("can get CRS from URN with version", { obj <- sosGetCRS("urn:ogc:def:crs:EPSG:99:4326") expect_s4_class(obj, "CRS") From 14c73e3174d37c45eee3d70d1e29c38e4de7f288 Mon Sep 17 00:00:00 2001 From: nuest Date: Fri, 12 Apr 2019 19:43:00 +0200 Subject: [PATCH 06/13] fix check warnings/errors --- DEV-README.md | 2 +- cran-comments.md | 2 ++ demo/00Index | 2 +- man/sosCreate.Rd | 8 ++++---- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/DEV-README.md b/DEV-README.md index 710ddfe..cf947af 100644 --- a/DEV-README.md +++ b/DEV-README.md @@ -255,7 +255,6 @@ A new release shall be uploaded to CRAN after testing and under the following pr - (optional) `rhub::check(email = <...>)` for running checks on different operating systems - Regenerate the website with `pkgdown::build_site()` and re-knit `README.Rmd`, commit changes - Push changes to `dev` branch -- Create a git tag with the version number using the letter `v` followed by the version number (see above, must match `DESCRIPTION`), e.g. `v1.2.3`, and push it to the main repository - Read and follow http://cran.r-project.org/web/packages/policies.html and http://r-pkgs.had.co.nz/release.html#release-check again, make necessary changes - Merge the PR - Update your local `master` to upstream's `master` branch @@ -264,6 +263,7 @@ A new release shall be uploaded to CRAN after testing and under the following pr -_ Do the actual release_ with `devtools::release()` (which will ask you again if you did many of the steps before) - Wait for the good news, check where the package is in the queue with `foghorn::cran_incoming(pkg = "sos4R")` - When available on CRAN: + - Create a git tag with the version number using the letter `v` followed by the version number (see above, must match `DESCRIPTION`), e.g. `v1.2.3`, and push it to the main repository - Checkout the `dev` branch - Merge `upstream/master` - Update the version in `DESCRIPTION` to a new development version, e.g. from `0.3.0` to `0.4.0.9000` diff --git a/cran-comments.md b/cran-comments.md index 7c534f3..7daabc8 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -15,3 +15,5 @@ No warnings. The package was "archived on 2018-06-17 as check problems were not corrected despite reminders." Issues could now finally be resolved with a complete overhaul of implementation (switching from XML to xml2) and we kindly request re-publication on CRAN. + +Comments during manual inspection were handled with this resubmission. diff --git a/demo/00Index b/demo/00Index index 4add912..8c9238c 100644 --- a/demo/00Index +++ b/demo/00Index @@ -1,3 +1,3 @@ co-ops SOSs by the NOAA Center for Operational Oceanographic Products and Services focussing on non-O&M response formats and filtering ioos SOS by Integrated Ocean Observing System -pegel Water gauge data in Germany by Pegelonline \ No newline at end of file +pegel Water gauge data in Germany by Pegelonline diff --git a/man/sosCreate.Rd b/man/sosCreate.Rd index 481fa6f..66fd81b 100644 --- a/man/sosCreate.Rd +++ b/man/sosCreate.Rd @@ -121,11 +121,11 @@ period <- sosCreateTimePeriod(sos = SOS_Test(), begin = as.POSIXct("2010/01/01"), end = as.POSIXct("2010/01/07")) eventTime <- sosCreateEventTimeList(period) -sosCreateTime(sos = mySOS, time = "2007-07-07 07:00::2008-08-08 08:00") -sosCreateTime(sos = mySOS, time = "2007-07-07 07:00/2010-10-10 10:00") +sosCreateTime(sos = SOS_Test(), time = "2007-07-07 07:00::2008-08-08 08:00") +sosCreateTime(sos = SOS_Test(), time = "2007-07-07 07:00/2010-10-10 10:00") -sosCreateTime(sos = mySOS, time = "::2007-08-05") -sosCreateTime(sos = mySOS, time = "2007-08-05/") +sosCreateTime(sos = SOS_Test(), time = "::2007-08-05") +sosCreateTime(sos = SOS_Test(), time = "2007-08-05/") } From 83ed3ea29723bc84344b59d493d81934f92fe666 Mon Sep 17 00:00:00 2001 From: nuest Date: Fri, 12 Apr 2019 19:44:05 +0200 Subject: [PATCH 07/13] update website --- DEV-README.md | 3 +- docs/DEV-README.html | 22 +++- .../sos4R-vignette-01-quickstart.html | 22 ++-- docs/articles/sos4R-vignette-02-ogc-sos.html | 2 +- .../sos4R-vignette-03-sos-operations.html | 118 ++++++++--------- .../sos4R-vignette-04-extensions.html | 124 +++++++++--------- docs/authors.html | 4 + docs/index.html | 4 +- docs/reference/Defaults.html | 14 +- docs/reference/DescribeSensor.html | 8 +- docs/reference/GML.html | 5 +- docs/reference/OGC.html | 4 +- docs/reference/OWS.html | 5 +- docs/reference/OmMeasurement.html | 6 +- docs/reference/OmObservation.html | 1 - docs/reference/SA.html | 3 +- docs/reference/SML.html | 39 ++++-- docs/reference/SOS.html | 57 ++++++-- docs/reference/SWE.html | 6 +- docs/reference/SosCapabilities.html | 18 +++ docs/reference/SosEventTime.html | 12 +- docs/reference/SosObservationOffering.html | 37 +++++- docs/reference/getObservation-methods.html | 25 +++- docs/reference/sosCreate.html | 30 +++-- 24 files changed, 357 insertions(+), 212 deletions(-) diff --git a/DEV-README.md b/DEV-README.md index cf947af..bdcf92d 100644 --- a/DEV-README.md +++ b/DEV-README.md @@ -258,12 +258,11 @@ A new release shall be uploaded to CRAN after testing and under the following pr - Read and follow http://cran.r-project.org/web/packages/policies.html and http://r-pkgs.had.co.nz/release.html#release-check again, make necessary changes - Merge the PR - Update your local `master` to upstream's `master` branch -- Create a git tag with the version number using the letter `v` followed by the version number (see above, must match `DESCRIPTION`), e.g. `v1.2.3`, and push it to the main repository -- Create a release on GitHub based on the new tag, named just as the version tag -_ Do the actual release_ with `devtools::release()` (which will ask you again if you did many of the steps before) - Wait for the good news, check where the package is in the queue with `foghorn::cran_incoming(pkg = "sos4R")` - When available on CRAN: - Create a git tag with the version number using the letter `v` followed by the version number (see above, must match `DESCRIPTION`), e.g. `v1.2.3`, and push it to the main repository + - Create a release on GitHub based on the new tag, named just as the version tag - Checkout the `dev` branch - Merge `upstream/master` - Update the version in `DESCRIPTION` to a new development version, e.g. from `0.3.0` to `0.4.0.9000` diff --git a/docs/DEV-README.html b/docs/DEV-README.html index 38fccd7..04f1723 100644 --- a/docs/DEV-README.html +++ b/docs/DEV-README.html @@ -397,9 +397,11 @@

Releases

A new release shall be uploaded to CRAN after testing and under the following procedure:

The standard exception codes and meanings are accessible by calling the following function.

- + @@ -586,14 +584,14 @@

exceptionCode
- +
## Warning in .handleExceptionReport(sos, .response): Object of class OwsExceptionReport; version: 1.0.0; lang: NA;
 ##  1 exception(s) (code @ locator : text):
 ##   MissingParameterValue @ ObservationId :
 ##  The value for the parameter 'ObservationId' is missing in the request!

The exception is also stored in the response object.

- +
## Object of class OwsExceptionReport; version: 1.0.0; lang: NA;
 ##  1 exception(s) (code @ locator : text):
 ##   MissingParameterValue @ ObservationId :
diff --git a/docs/authors.html b/docs/authors.html
index 7cbae7a..93c6931 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -184,6 +184,10 @@ 

Authors

Eike Hinderk Juerrens. Contributor.

+
  • +

    52°North Initiative for Geospatial Open Source Software GmbH. Copyright holder. +

    +
  • diff --git a/docs/index.html b/docs/index.html index 428a077..020fc7a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,11 +5,11 @@ -An R Client for the OGC Sensor Observation Service • sos4R +Client for the OGC Sensor Observation Service • sos4R - + Examp #> { #> return("EXCEPTION!!!11") #> } -#> <environment: 0xe503618> +#> <environment: 0xa21b988> #> #> $GetCapabilities #> function (obj, sos) @@ -1051,6 +1051,11 @@

    Examp #> { #> if (verbose) #> cat("[parseCSV] Processing CSV...\n") +#> if (inherits(x = obj, what = "data.frame")) { +#> if (verbose) +#> cat("[parseCSV] Already a data.frame, returning object\n") +#> return(obj) +#> } #> .lines <- strsplit(x = obj, split = "\n")[[1]] #> .data <- do.call(what = "strsplit", args = list(.lines, split = ",")) #> .names <- .data[[1]] @@ -1270,7 +1275,7 @@

    Examp #> { #> return("EXCEPTION!!!11") #> } -#> <environment: 0xe503618> +#> <environment: 0xa21b988> #>
    SosParsingFunctions(exclude = c("GetObservation", "DescribeSensor"))
    #> $GetCapabilities #> function (obj, sos) #> { @@ -1944,6 +1949,11 @@

    Examp #> { #> if (verbose) #> cat("[parseCSV] Processing CSV...\n") +#> if (inherits(x = obj, what = "data.frame")) { +#> if (verbose) +#> cat("[parseCSV] Already a data.frame, returning object\n") +#> return(obj) +#> } #> .lines <- strsplit(x = obj, split = "\n")[[1]] #> .data <- do.call(what = "strsplit", args = list(.lines, split = ",")) #> .names <- .data[[1]] diff --git a/docs/reference/DescribeSensor.html b/docs/reference/DescribeSensor.html index efbfa65..2990089 100644 --- a/docs/reference/DescribeSensor.html +++ b/docs/reference/DescribeSensor.html @@ -223,7 +223,13 @@

    Examp sos <- SOS_Test() encodeRequestXML(describeSensorRequest, sos)

    #> {xml_document} #> <DescribeSensor service="SOS" outputFormat="text/xml" version="1.0.0" xmlns="http://www.opengis.net/sos/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> -#> [1] <procedure>urn:procedure:42</procedure>
    toString(encodeRequestXML(describeSensorRequest, sos))
    #> [1] "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeSensor xmlns=\"http://www.opengis.net/sos/1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" service=\"SOS\" outputFormat=\"text/xml\" version=\"1.0.0\">\n <procedure>urn:procedure:42</procedure>\n</DescribeSensor>\n"

    +#> [1] <procedure>urn:procedure:42</procedure>
    toString(encodeRequestXML(describeSensorRequest, sos))
    #> [1] "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeSensor xmlns=\"http://www.opengis.net/sos/1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" service=\"SOS\" outputFormat=\"text/xml\" version=\"1.0.0\">\n <procedure>urn:procedure:42</procedure>\n</DescribeSensor>\n"
    +# request a sensor description +mySOS <- SOS(url = "http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp", + binding = "KVP")
    #> [sos4R] Created SOS for URL http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp
    mySensor <- describeSensor(sos = mySOS, + procedure = sosProcedures(mySOS)[[1]], + outputFormat = 'text/xml; subtype="sensorML/1.0.1"', # space is needed! + )
    #> GmlTimePeriod: [ Object of class GmlTimeInstantProperty; href: NA; time: GmlTimePosition [ time: 2019-04-04 13:26:20 ] -#> --> Object of class GmlTimeInstantProperty; href: NA; time: GmlTimePosition [ time: 2019-04-11 13:26:20 ] ]
    -
    +GmlTimePeriod(begin = aWeekAgo, end = now)
    #> GmlTimePeriod: [ Object of class GmlTimeInstantProperty; href: NA; time: GmlTimePosition [ time: 2019-04-05 19:42:50 ] +#> --> Object of class GmlTimeInstantProperty; href: NA; time: GmlTimePosition [ time: 2019-04-12 19:42:50 ] ]
    -# TBD examples for construction functions -
    +#> Class "OgcOverlaps", by class "OgcBinarySpatialOp", distance 3
    -# TBD examples for construction functions - -
    +#> Class ".NULL", by class "NULL", distance 2, with explicit coerce
    -# TBD examples for construction function - -# TBD examples for sosResult -
    +#> Class "OmObservationOrNULL", by class "OmObservation", distance 2
    -# TBD examples for construction methods OmObservationProperty(href = "http://link.to/myObservation")
    #> Object of class OmObservationProperty; href: http://link.to/myObservation; observation:
    # get result from an observation
    # NOT RUN { diff --git a/docs/reference/SA.html b/docs/reference/SA.html index e6bdfa0..89fb5d2 100644 --- a/docs/reference/SA.html +++ b/docs/reference/SA.html @@ -226,8 +226,7 @@

    Examp # create sampling point SaSamplingPoint(sampledFeatures = list("feature1", "feature2"), position = GmlPointProperty(href = "http://link.to/point"))
    #> Object of class SaSamplingPoint; id: NA; position: Object of class GmlPointProperty; href: http://link.to/point; point: , relatedObservation: NA, relatedSamplingFeature: , surveyDetails: NA; -#> sampledFeatures: feature1, feature2
    -
    +#> sampledFeatures: feature1, feature2