Abstract

The sos4R package provides simple yet powerful access to OGC Sensor Observation Service instances. The package supports both encapsulation and abstraction from the service interface for novice users as well as powerful request building for specialists. sos4R is motivated by the idea to close the gap between the Sensor Web and tools for (geo-)statistical analyses. It implements the core profile of the SOS specification and supports temporal, spatial, and thematical filtering of observations.

This document gives a brief overview and demo. Other vignettes dive deeper into the SOS specification and the package’s features are explained extensively: exploration of service metadata, request building with filters, function exchangeability, result data transformation.

The package is published under GPL 2 license within the geostatistics community of 52°North Initiative for Geospatial Open Source Software.

Introduction

The sos4R package provides classes and methods for retrieving data from an Open Geospatial Consortium (OGC) Sensor Observation Service in version 1.0.0 (Na, 2007) and 2.0 (Bröring, 2010). The goal of this package is to provide easy access with a low entry threshold for everyone to information available via SOSs. The complexity of the service interface shall be shielded from the user as much as possible, while still leaving enough possiblities for advanced users. The output is a standard data.frame with attributed columns for the rich metadata provided by the SOS API. This package uses S4 classes and methods style (Chambers, 1998).

The package was born out of perceiving a missing link between the Sensor Web community (known as Sensor Web Enablement (SWE) Initiative in the OGC realm) and the community of (geo-)statisticians (Nüst, 2011). While the relatively young SWE standards get adopted more by data owners (like governmental organizations), we see a high but unused potential for more open data and spatio-temporal analyses based on it. sos4R can help enabling this.

The project is part of the geostatistics community of the 52°North Initiative for Geospatial Open Source Software. sos4R is available on CRAN.

On the package home page, https://52north.github.io/sos4R, you can stay updated with the developments and find example code and services.

This software is released under a GPL 2 license and contributions are very welcome—please see the file DEV-README.md in the package code repository.

library("sos4R")

Getting started

Cheat sheet

The package comes with a one page quick reference card, also known as a “cheat sheet”, which shows everything that you need to know in an extremely concise manner. You can open the document by loading the package and calling

The most useful functions are highlighted in bold font.

Demos and services

The demos are a good way to get started with the package. Please be aware that you need an internet connection for these demos, the used SOSs might be temporarily unavailable or not available anymore.

# list available demos:
demo(package = "sos4R")
# run a demo:
demo("airquality")
  • ades: SOS with French groundwater level data - under construction.
  • airquality] The Air Quality SOS by ifgi provides [EEA AirBase:(http://www.eea.europa.eu/themes/air/airbase) data for Germany (and other countries). It is used for this demo about spatio-temporal interpolation with inverse distance weighting of NO2 observation in Germany using the packages gstat and spacetime.
  • austria: SOSs by Research Studios Austria - under construction.
  • ioos: Example using SOS by the Integrated Ocean Observing System which provides data in different formats (KML, CSV)
  • marinemeta: SOS by Marine Metadata Interoperability Initiative - under construction.
  • oceanwatch: SOS by NOAA/SWFSC/ERD - under construction.
  • pegel: Water gauge data in Germany by Pegelonline, shows how to create an xyplot of a set of variables.
  • southesk: SOSs from South Esk Testbed by CSIRO, focuses on data consolidation/fusion and plotting. It also contains an example for partially changing the encoding by overriding a specific encodeXML function.
  • weathersos: Time series analysis demo with weather data by ifgi, includes examples for DescribeSensor and data extraction from and plotting of SensorML sensor descriptions.

There also is an incomplete list of services that have been tested or are currently evaluated on the project homepage. If you find or can provide new SOS with data useful to others, please do not hesitate to open an issue so that it can be included.

Additionally, a set of SOS URLs are available via the function SosExampleServices(). Please note that the author of this document does not control these services and does not guarantee for any factors like correctness of data or availability.

Creating a SOS connection

The method SOS() is a construction method for classes encapsulating a connection to a SOS. It prints out a short statement when the connection was successfully established (i.e. the capabilities document was received) and returns an object of class SOS.

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

To create a SOS connection you only need the URL of the service (i.e. the URL endpoint which can be used for HTTP requests). The service connection created above is used for all examples throughout this document.

All parameters except the service endpoint are optional and use default settings:

  • method: The transport protocol. Currently available are Key-value-pair (GET), Plain old XML (POST); the default is POX. GET is less powerful, especially regarding filtering operations.
  • version: The service version. Currently available version(s) is/are 1.0.0, 2.0.0.
  • parsers: The list of parsing functions. See vignette “Extending”.
  • encoders: The list of encoding functions. See vignette “Extending”.
  • dataFieldConverters: The list of conversion functions. See vignette “Extending”.
  • timeFormat: The time format to be used or decoding and encoding time character strings to and from POSIXt classes, the default is %Y-%m-%dT%H:%M:%OS.
  • verboseOutput: Trigger parameter for extensive debugging information on the console for all requests made to this SOS instance.
  • switchCoordinates: Switches all coordinates that are encountered during the parsing phase, such as in an element like <gml:lowerCorner>117.3 -41.5</gml:lowerCorner>.

There are accessor methods for the slots of the class. The encoders, parsers and converters are described extensively in the vignette “Extending”.

You can also access the used encoding, decoding, and conversion functions (extensive output not included here).

Print and summary methods are available for important classes, like SOS.

Get Data

The GetObservation operation is the main data download request of the SOS, and the package’s functional equivalent is getObservation(..). You can build a request using the information from the offerings, as they are extracted from the capabilities document when a new connection is created.

Not all combinations of procedure, observed property, feature of interest, and event time will deliver a result, but the following one should.

You can then access the result data with the helper function sosResult(..).

Inspect Requests and Verbose Printing

The package offers two levels of inspection of the ongoing operations indicated by two boolean parameters, inspect and verbose. These are available in all service operation calls.

  • inspect prints the raw requests and responses to the console.
  • verbose prints not only the requests, but also debugging and processing statements (e.g. intermediate steps during parsing).

The option verboseOutput when using the method SOS() turns on the verbose setting for all subsequent requests made to the created connection unless deactivated in an operation call.

obs.1 <- getObservation(sos = mySOS, offering = off.1,
    procedure = sosProcedures(off.1)[[1]],
    observedProperty = sosObservedProperties(off.1)[1],
    eventTime = sosCreateTime(sos = mySOS, time = "2017-12-19::2017-12-20"),
    inspect = TRUE)
#> [.sosRequest_1.0.0] GET!
#> [.sosRequest_1.0.0] REQUEST:
#>   http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp?service=SOS&version=1.0.0&request=GetObservation&offering=ws2500&observedProperty=AirTemperature&responseFormat=text%2Fxml%3Bsubtype%3D%22om%2F1.0.0%22&eventTime=2017-12-19T00%3A00%3A00%2F2017-12-20T00%3A00%3A00&procedure=ws2500 
#> [.getObservation_1.0.0] RESPONSE DOC:
#> {xml_document}
#> <ObservationCollection id="oc_1555162551516" schemaLocation="http://www.opengis.net/om/1.0 http://schemas.opengis.net/om/1.0.0/om.xsd http://www.opengis.net/sampling/1.0 http://schemas.opengis.net/sampling/1.0.0/sampling.xsd http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosAll.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/gml.xsd http://www.opengis.net/swe/1.0.1 http://schemas.opengis.net/sweCommon/1.0.1/swe.xsd" xmlns:om="http://www.opengis.net/om/1.0" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sa="http://www.opengis.net/sampling/1.0" xmlns:swe="http://www.opengis.net/swe/1.0.1">
#> [1] <gml:boundedBy>\n  <gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326 ...
#> [2] <om:member>\n  <om:Observation gml:id="o_1555162551516">\n    <om:sa ...
#> [sos4R] Finished getObservation to http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp 
#>  --> received 1 observation(s) having 72 result values [ 72 ].
getObservation(sos = mySOS, offering = off.1,
    procedure = sosProcedures(off.1)[[1]],
    observedProperty = sosObservedProperties(off.1)[2],
    eventTime = sosCreateTime(sos = mySOS, time = "2018-01-01::2018-01-03"),
    verbose = TRUE)
#> [getObservation] Requesting offering ws2500 by SosObservationOffering.
#> [.getObservation_1.0.0] to  http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp  with offering  ws2500 
#> [.createGetObservation_1.0.0] Done:
#>  Object of class SosGetObservation:  service:  SOS , version:  1.0.0 , offering:  ws2500 
#> observered property:  AthmosphericPressure 
#> responseFormat(s):  text/xml;subtype="om/1.0.0" , responseMode(s):  NA 
#> procedure(s) ws2500 
#>  feature(s) of interest  
#>  event time:  new("SosEventTime", temporalOps = new("TM_During", time = new("GmlTimePeriod", begin = NULL, beginPosition = new("GmlTimePosition", time = 1514761200, frame = NA, calendarEraName = NA, indeterminatePosition = NA), end = NULL, endPosition = new("GmlTimePosition", time = 1514934000, frame = NA, calendarEraName = NA, indeterminatePosition = NA), duration = NA, timeInterval = NULL, frame = NA, relatedTimes = list(NA), id = NA), propertyName = "om:samplingTime")) 
#>  result:  NULL 
#> srsName:  NA 
#> resultModel(s):  NA 
#> temporal value reference:  NA 
#>  
#> [.getObservation_1.0.0] REQUEST:
#> 
#>  Object of class SosGetObservation:  service:  SOS , version:  1.0.0 , offering:  ws2500 
#> observered property:  AthmosphericPressure 
#> responseFormat(s):  text/xml;subtype="om/1.0.0" , responseMode(s):  NA 
#> procedure(s) ws2500 
#>  feature(s) of interest  
#>  event time:  new("SosEventTime", temporalOps = new("TM_During", time = new("GmlTimePeriod", begin = NULL, beginPosition = new("GmlTimePosition", time = 1514761200, frame = NA, calendarEraName = NA, indeterminatePosition = NA), end = NULL, endPosition = new("GmlTimePosition", time = 1514934000, frame = NA, calendarEraName = NA, indeterminatePosition = NA), duration = NA, timeInterval = NULL, frame = NA, relatedTimes = list(NA), id = NA), propertyName = "om:samplingTime")) 
#>  result:  NULL 
#> srsName:  NA 
#> resultModel(s):  NA 
#> temporal value reference:  NA 
#>  
#> [.sosRequest_1.0.0] Encoding Function (beginning of function body):  { standardGeneric("encodeRequestKVP")  ... [ 0  more chrs].
#> [.sosEncodeRequestKVPGetObservation_1.0.0] encoding Object of class SosGetObservation:  service:  SOS , version:  1.0.0 , offering:  ws2500 
#> observered property:  AthmosphericPressure 
#> responseFormat(s):  text/xml;subtype="om/1.0.0" , responseMode(s):  NA 
#> procedure(s) ws2500 
#>  feature(s) of interest  
#>  event time:  new("SosEventTime", temporalOps = new("TM_During", time = new("GmlTimePeriod", begin = NULL, beginPosition = new("GmlTimePosition", time = 1514761200, frame = NA, calendarEraName = NA, indeterminatePosition = NA), end = NULL, endPosition = new("GmlTimePosition", time = 1514934000, frame = NA, calendarEraName = NA, indeterminatePosition = NA), duration = NA, timeInterval = NULL, frame = NA, relatedTimes = list(NA), id = NA), propertyName = "om:samplingTime")) 
#>  result:  NULL 
#> srsName:  NA 
#> resultModel(s):  NA 
#> temporal value reference:  NA 
#>  
#> [.sosEncodeRequestKVPGetObservation_1.0.0] mandatory elements:  service=SOS&version=1.0.0&request=GetObservation&offering=ws2500&observedProperty=AthmosphericPressure 
#> [.sosEncodeRequestKVPGetObservation_1.0.0] Adding response format  text/xml;subtype="om/1.0.0" 
#> [.sosEncodeRequestKVPGetObservation_1.0.0] Adding event time new("SosEventTime", temporalOps = new("TM_During", time = new("GmlTimePeriod", begin = NULL, beginPosition = new("GmlTimePosition", time = 1514761200, frame = NA, calendarEraName = NA, indeterminatePosition = NA), end = NULL, endPosition = new("GmlTimePosition", time = 1514934000, frame = NA, calendarEraName = NA, indeterminatePosition = NA), duration = NA, timeInterval = NULL, frame = NA, relatedTimes = list(NA), id = NA), propertyName = "om:samplingTime")) 
#> ENCODE KVP  SosEventTime 
#> [encodeKVP] temporalOps:  Object of class TM_During; propertyName: om:samplingTime time: GmlTimePeriod: [ GmlTimePosition [ time: 2018-01-01 ]
#>  --> GmlTimePosition [ time: 2018-01-03 ] ] 
#> [encodeKVP] Encoding period with beginPosition and endPosition.
#> [encodeKVP] POSIXt with value 2018-01-01 
#> Formatted  1514761200  to  2018-01-01T00:00:00 
#> [encodeKVP] POSIXt with value 2018-01-03 
#> Formatted  1514934000  to  2018-01-03T00:00:00 
#> [.sosEncodeRequestKVPGetObservation_1.0.0] Adding procedures  ws2500 
#> [.sosEncodeRequestKVPGetObservation_1.0.0] optional elements:  &responseFormat=text%2Fxml%3Bsubtype%3D%22om%2F1.0.0%22&eventTime=2018-01-01T00%3A00%3A00%2F2018-01-03T00%3A00%3A00&procedure=ws2500 
#> [.sosEncodeRequestKVPGetObservation_1.0.0] Finished KVP string creation:
#>  service=SOS&version=1.0.0&request=GetObservation&offering=ws2500&observedProperty=AthmosphericPressure&responseFormat=text%2Fxml%3Bsubtype%3D%22om%2F1.0.0%22&eventTime=2018-01-01T00%3A00%3A00%2F2018-01-03T00%3A00%3A00&procedure=ws2500 
#> [.sosRequest_1.0.0] Using DCP from operation description.
#> [.sosFilterDCPs] Applying pattern * to http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp? 
#> [.sosFilterDCPs] Filtered from
#>   http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp? 
#>  to
#>   http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp? 
#> Given url already contains a '?', appending arguments!
#> [.sosRequest_1.0.0] Do request...
#> [.processResponse] Response status:  200  | type:  application/xml 
#> [.sosRequest_1.0.0] ... done.
#> [.sosRequest_1.0.0] RESPONSE:
#> {xml_document}
#> <ObservationCollection id="oc_1555162551773" schemaLocation="http://www.opengis.net/om/1.0 http://schemas.opengis.net/om/1.0.0/om.xsd http://www.opengis.net/sampling/1.0 http://schemas.opengis.net/sampling/1.0.0/sampling.xsd http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosAll.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/gml.xsd http://www.opengis.net/swe/1.0.1 http://schemas.opengis.net/sweCommon/1.0.1/swe.xsd" xmlns:om="http://www.opengis.net/om/1.0" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sa="http://www.opengis.net/sampling/1.0" xmlns:swe="http://www.opengis.net/swe/1.0.1">
#> [1] <gml:boundedBy>\n  <gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326 ...
#> [2] <om:member>\n  <om:Observation gml:id="o_1555162551773">\n    <om:sa ...
#> [sos4R] Received response (object size: 784 bytes), parsing ...
#> [.getObservation_1.0.0] Got XML document as response.
#> [.getObservation_1.0.0] Parsing with function function(obj, sos, verbose = FALSE) {
#>   .om <- NULL
#> 
#>   # switch submethods based on name (needs prefix)
#>   .name <- xml2::xml_name(x = obj, ns = SosAllNamespaces())
#> 
#>   .parsingFunction <- sosParsers(sos)[[.name]]
#>   if (!is.null(.parsingFunction)) {
#>     if (verbose) cat("[parseOM] Matched name for parser is", .name, "\n")
#>     .om <- .parsingFunction(obj = obj, sos = sos, verbose = verbose)
#>     if (verbose) cat("[parseOM] Done parsing\n")
#>   }
#>   else {
#>     warning(paste("[parseOM] No parsing function for given element", .name))
#>   }
#> 
#>   return(.om)
#> }
#> <bytecode: 0x4a6c148>
#> <environment: namespace:sos4R>
#> [parseOM] Matched name for parser is om:ObservationCollection 
#> [parseObservationCollection] with  1 element(s).
#> [parseObservationCollection] Parsed envelope: urn:ogc:def:crs:EPSG::4326, 51.934814453125 7.652428150177, 51.934814453125 7.652428150177 
#> [parseOM] Matched name for parser is om:member 
#> [parseObservationProperty] Parsing child of member: om:Observation 
#> [parseOM] Matched name for parser is om:Observation 
#> [parseObservation] o_1555162551773 
#> [parsePhenomenonProperty] with reference AthmosphericPressure 
#> [parseTime] Entering
#> [parseTime] Found time period
#> [parseTime] Done: GmlTimePeriod: [ GmlTimePosition [ time: 2018-01-01 00:30:00 ]
#>  --> GmlTimePosition [ time: 2018-01-03 ] ] 
#> [parseFOI] starting...
#> [parseFOI] inline FOI: sa:SamplingPoint 
#> [parseResult] Starting ...
#> [parseResult] 1  non-text nodes, names: DataArray 
#> [parseResult] Parsing result with swe:DataArray.
#> [parseDataArray] Parsing DataArray with 144 elements.
#> [parseElementType] Got child DataRecord and id NA for object elementType 
#> [parseElementType] Got data record with 2 fields. 
#> [parseField] Parsing field description of  phenomenonTime 
#> [parseField] Parsed field phenomenonTime, http://www.opengis.net/def/property/OGC/0/PhenomenonTime 
#> [parseField] Parsing field description of  AthmosphericPressure 
#> [parseField] Parsed field AthmosphericPressure, AthmosphericPressure, hPa 
#> [parseElementType] Names of parsed fields: 
#> [parseDataArray] Parsed field descriptions: c(name = "phenomenonTime", definition = "http://www.opengis.net/def/property/OGC/0/PhenomenonTime"), c(name = "AthmosphericPressure", definition = "AthmosphericPressure", uom = "hPa") 
#> [parseDataArray] Parsed encoding description: Object of class SweTextBlock ', @@ .'; id: NA 
#> [parseValues] Parsing swe:values using Object of class SweTextBlock ', @@ .'; id: NA and 2 fields: phenomenonTime, AthmosphericPressure 
#> [parseValues] Parsing values from lines:  c("2018-01-01T00:30:00.000Z", "990.0"), c("2018-01-01T00:45:00.000Z", "990.0"), c("2018-01-01T01:00:00.000Z", "990.0"), c("2018-01-01T01:30:00.000Z", "990.0"), c("2018-01-01T01:45:00.000Z", "990.0"), c("2018-01-01T02:00:00.000Z", "990.0"), c("2018-01-01T02:30:00.000Z", "990.0"), c("2018-01-01T02:45:00.000Z", "990.0"), c("2018-01-01T03:00:00.000Z", "990.0"), c("2018-01-01T03:30:00.000Z", "990.0"), c("2018-01-01T03:45:00.000Z", "990.0"), c("2018-01-01T04:00:00.000Z", "990.0"), c("2018-01-01T04:30:00.000Z", "991.0"), c("2018-01-01T04:45:00.000Z", "991.0"), c("2018-01-01T05:00:00.000Z", "991.0"), c("2018-01-01T05:30:00.000Z", "992.0"), c("2018-01-01T05:45:00.000Z", "992.0"), c("2018-01-01T06:15:00.000Z", "992.0"), c("2018-01-01T06:30:00.000Z", "993.0"), c("2018-01-01T06:45:00.000Z", "993.0"), c("2018-01-01T07:00:00.000Z", "993.0"), c("2018-01-01T07:30:00.000Z", "994.0"), c("2018-01-01T07:45:00.000Z", "994.0"), c("2018-01-01T08:00:00.000Z", "994.0"), c("2018-01-01T08:30:00.000Z", "994.0"), c("2018-01-01T08:45:00.000Z", "994.0"), c("2018-01-01T09:00:00.000Z", "994.0"), c("2018-01-01T09:30:00.000Z", "995.0"), c("2018-01-01T09:45:00.000Z", "995.0"), c("2018-01-01T10:00:00.000Z", "995.0"), c("2018-01-01T10:30:00.000Z", "994.0"), c("2018-01-01T10:45:00.000Z", "994.0"), c("2018-01-01T11:00:00.000Z", "994.0"), c("2018-01-01T11:30:00.000Z", "994.0"), c("2018-01-01T11:45:00.000Z", "994.0"), c("2018-01-01T12:00:00.000Z", "993.0"), c("2018-01-01T12:30:00.000Z", "993.0"), c("2018-01-01T12:45:00.000Z", "993.0"), c("2018-01-01T13:00:00.000Z", "993.0"), c("2018-01-01T13:30:00.000Z", "992.0"), c("2018-01-01T13:45:00.000Z", "992.0"), c("2018-01-01T14:00:00.000Z", "992.0"), c("2018-01-01T14:30:00.000Z", "991.0"), c("2018-01-01T14:45:00.000Z", "991.0"), c("2018-01-01T15:00:00.000Z", "991.0"), c("2018-01-01T15:30:00.000Z", "991.0"), c("2018-01-01T15:45:00.000Z", "990.0"), c("2018-01-01T16:00:00.000Z", "990.0"), c("2018-01-01T16:30:00.000Z", "990.0"), c("2018-01-01T16:45:00.000Z", "990.0"), c("2018-01-01T17:00:00.000Z", "990.0"), c("2018-01-01T17:30:00.000Z", "990.0"), c("2018-01-01T17:45:00.000Z", "990.0"), c("2018-01-01T18:00:00.000Z", "990.0"), c("2018-01-01T18:30:00.000Z", "989.0"), c("2018-01-01T18:45:00.000Z", "989.0"), c("2018-01-01T19:00:00.000Z", "989.0"), c("2018-01-01T19:30:00.000Z", "989.0"), c("2018-01-01T19:45:00.000Z", "989.0"), c("2018-01-01T20:00:00.000Z", "989.0"), c("2018-01-01T20:30:00.000Z", "989.0"), c("2018-01-01T20:45:00.000Z", "990.0"), c("2018-01-01T21:00:00.000Z", "990.0"), c("2018-01-01T21:30:00.000Z", "990.0"), c("2018-01-01T21:45:00.000Z", "990.0"), c("2018-01-01T22:00:00.000Z", "991.0"), c("2018-01-01T22:30:00.000Z", "991.0"), c("2018-01-01T22:45:00.000Z", "991.0"), c("2018-01-01T23:00:00.000Z", "992.0"), c("2018-01-01T23:30:00.000Z", "993.0"), c("2018-01-01T23:45:00.000Z", "993.0"), c("2018-01-02T00:00:00.000Z", "993.0"), c("2018-01-02T00:30:00.000Z", "993.0"), c("2018-01-02T00:45:00.000Z", "994.0"), c("2018-01-02T01:00:00.000Z", "994.0"), c("2018-01-02T01:30:00.000Z", "995.0"), c("2018-01-02T01:45:00.000Z", "995.0"), c("2018-01-02T02:00:00.000Z", "995.0"), c("2018-01-02T02:30:00.000Z", "996.0"), c("2018-01-02T02:45:00.000Z", "996.0"), c("2018-01-02T03:00:00.000Z", "996.0"), c("2018-01-02T03:30:00.000Z", "996.0"), c("2018-01-02T03:45:00.000Z", "997.0"), c("2018-01-02T04:00:00.000Z", "997.0"), c("2018-01-02T04:30:00.000Z", "997.0"), c("2018-01-02T04:45:00.000Z", "997.0"), c("2018-01-02T05:00:00.000Z", "998.0"), c("2018-01-02T05:30:00.000Z", "998.0"), c("2018-01-02T05:45:00.000Z", "998.0"), c("2018-01-02T06:15:00.000Z", "999.0"), c("2018-01-02T06:30:00.000Z", "999.0"), c("2018-01-02T06:45:00.000Z", "999.0"), c("2018-01-02T07:00:00.000Z", "1000.0"), c("2018-01-02T07:30:00.000Z", "1000.0"), c("2018-01-02T07:45:00.000Z", "1000.0"), c("2018-01-02T08:00:00.000Z", "1000.0"), c("2018-01-02T08:30:00.000Z", "1001.0"), c("2018-01-02T08:45:00.000Z", "1001.0"), c("2018-01-02T09:00:00.000Z", "1001.0"), c("2018-01-02T09:30:00.000Z", "1002.0"), c("2018-01-02T09:45:00.000Z", "1002.0"), c("2018-01-02T10:00:00.000Z", "1002.0"), c("2018-01-02T10:30:00.000Z", "1003.0"), c("2018-01-02T10:45:00.000Z", "1003.0"), c("2018-01-02T11:00:00.000Z", "1003.0"), c("2018-01-02T11:30:00.000Z", "1003.0"), c("2018-01-02T11:45:00.000Z", "1003.0"), c("2018-01-02T12:00:00.000Z", "1003.0"), c("2018-01-02T12:30:00.000Z", "1003.0"), c("2018-01-02T12:45:00.000Z", "1003.0"), c("2018-01-02T13:00:00.000Z", "1003.0"), c("2018-01-02T13:30:00.000Z", "1003.0"), c("2018-01-02T13:45:00.000Z", "1003.0"), c("2018-01-02T14:00:00.000Z", "1003.0"), c("2018-01-02T14:30:00.000Z", "1003.0"), c("2018-01-02T14:45:00.000Z", "1003.0"), c("2018-01-02T15:00:00.000Z", "1002.0"), c("2018-01-02T15:30:00.000Z", "1002.0"), c("2018-01-02T15:45:00.000Z", "1002.0"), c("2018-01-02T16:00:00.000Z", "1002.0"), c("2018-01-02T16:30:00.000Z", "1002.0"), c("2018-01-02T16:45:00.000Z", "1002.0"), c("2018-01-02T17:00:00.000Z", "1001.0"), c("2018-01-02T17:30:00.000Z", "1001.0"), c("2018-01-02T17:45:00.000Z", "1001.0"), c("2018-01-02T18:00:00.000Z", "1000.0"), c("2018-01-02T18:30:00.000Z", "1000.0"), c("2018-01-02T18:45:00.000Z", "1000.0"), c("2018-01-02T19:00:00.000Z", "999.0"), c("2018-01-02T19:30:00.000Z", "999.0"), c("2018-01-02T19:45:00.000Z", "998.0"), c("2018-01-02T20:00:00.000Z", "998.0"), c("2018-01-02T20:30:00.000Z", "997.0"), c("2018-01-02T20:45:00.000Z", "997.0"), c("2018-01-02T21:00:00.000Z", "996.0"), c("2018-01-02T21:30:00.000Z", "995.0"), c("2018-01-02T21:45:00.000Z", "995.0"), c("2018-01-02T22:00:00.000Z", "994.0"), c("2018-01-02T22:30:00.000Z", "993.0"), c("2018-01-02T22:45:00.000Z", "993.0"), c("2018-01-02T23:00:00.000Z", "992.0"), c("2018-01-02T23:30:00.000Z", "991.0"), c("2018-01-02T23:45:00.000Z", "991.0"), c("2018-01-03T00:00:00.000Z", "990.0") 
#> [parseValues] Processing field index 1 of 2 
#> [parseValues] Current values:  2018-01-01T00:30:00.000Z, 2018-01-01T00:45:00.000Z, 2018-01-01T01:00:00.000Z, 2018-01-01T01:30:00.000Z, 2018-01-01T01:45:00.000Z, 2018-01-01T02:00:00.000Z, 2018-01-01T02:30:00.000Z, 2018-01-01T02:45:00.000Z, 2018-01-01T03:00:00.000Z, 2018-01-01T03:30:00.000Z, 2018-01-01T03:45:00.000Z, 2018-01-01T04:00:00.000Z, 2018-01-01T04:30:00.000Z, 2018-01-01T04:45:00.000Z, 2018-01-01T05:00:00.000Z, 2018-01-01T05:30:00.000Z, 2018-01-01T05:45:00.000Z, 2018-01-01T06:15:00.000Z, 2018-01-01T06:30:00.000Z, 2018-01-01T06:45:00.000Z, 2018-01-01T07:00:00.000Z, 2018-01-01T07:30:00.000Z, 2018-01-01T07:45:00.000Z, 2018-01-01T08:00:00.000Z, 2018-01-01T08:30:00.000Z, 2018-01-01T08:45:00.000Z, 2018-01-01T09:00:00.000Z, 2018-01-01T09:30:00.000Z, 2018-01-01T09:45:00.000Z, 2018-01-01T10:00:00.000Z, 2018-01-01T10:30:00.000Z, 2018-01-01T10:45:00.000Z, 2018-01-01T11:00:00.000Z, 2018-01-01T11:30:00.000Z, 2018-01-01T11:45:00.000Z, 2018-01-01T12:00:00.000Z, 2018-01-01T12:30:00.000Z, 2018-01-01T12:45:00.000Z, 2018-01-01T13:00:00.000Z, 2018-01-01T13:30:00.000Z, 2018-01-01T13:45:00.000Z, 2018-01-01T14:00:00.000Z, 2018-01-01T14:30:00.000Z, 2018-01-01T14:45:00.000Z, 2018-01-01T15:00:00.000Z, 2018-01-01T15:30:00.000Z, 2018-01-01T15:45:00.000Z, 2018-01-01T16:00:00.000Z, 2018-01-01T16:30:00.000Z, 2018-01-01T16:45:00.000Z, 2018-01-01T17:00:00.000Z, 2018-01-01T17:30:00.000Z, 2018-01-01T17:45:00.000Z, 2018-01-01T18:00:00.000Z, 2018-01-01T18:30:00.000Z, 2018-01-01T18:45:00.000Z, 2018-01-01T19:00:00.000Z, 2018-01-01T19:30:00.000Z, 2018-01-01T19:45:00.000Z, 2018-01-01T20:00:00.000Z, 2018-01-01T20:30:00.000Z, 2018-01-01T20:45:00.000Z, 2018-01-01T21:00:00.000Z, 2018-01-01T21:30:00.000Z, 2018-01-01T21:45:00.000Z, 2018-01-01T22:00:00.000Z, 2018-01-01T22:30:00.000Z, 2018-01-01T22:45:00.000Z, 2018-01-01T23:00:00.000Z, 2018-01-01T23:30:00.000Z, 2018-01-01T23:45:00.000Z, 2018-01-02T00:00:00.000Z, 2018-01-02T00:30:00.000Z, 2018-01-02T00:45:00.000Z, 2018-01-02T01:00:00.000Z, 2018-01-02T01:30:00.000Z, 2018-01-02T01:45:00.000Z, 2018-01-02T02:00:00.000Z, 2018-01-02T02:30:00.000Z, 2018-01-02T02:45:00.000Z, 2018-01-02T03:00:00.000Z, 2018-01-02T03:30:00.000Z, 2018-01-02T03:45:00.000Z, 2018-01-02T04:00:00.000Z, 2018-01-02T04:30:00.000Z, 2018-01-02T04:45:00.000Z, 2018-01-02T05:00:00.000Z, 2018-01-02T05:30:00.000Z, 2018-01-02T05:45:00.000Z, 2018-01-02T06:15:00.000Z, 2018-01-02T06:30:00.000Z, 2018-01-02T06:45:00.000Z, 2018-01-02T07:00:00.000Z, 2018-01-02T07:30:00.000Z, 2018-01-02T07:45:00.000Z, 2018-01-02T08:00:00.000Z, 2018-01-02T08:30:00.000Z, 2018-01-02T08:45:00.000Z, 2018-01-02T09:00:00.000Z, 2018-01-02T09:30:00.000Z, 2018-01-02T09:45:00.000Z, 2018-01-02T10:00:00.000Z, 2018-01-02T10:30:00.000Z, 2018-01-02T10:45:00.000Z, 2018-01-02T11:00:00.000Z, 2018-01-02T11:30:00.000Z, 2018-01-02T11:45:00.000Z, 2018-01-02T12:00:00.000Z, 2018-01-02T12:30:00.000Z, 2018-01-02T12:45:00.000Z, 2018-01-02T13:00:00.000Z, 2018-01-02T13:30:00.000Z, 2018-01-02T13:45:00.000Z, 2018-01-02T14:00:00.000Z, 2018-01-02T14:30:00.000Z, 2018-01-02T14:45:00.000Z, 2018-01-02T15:00:00.000Z, 2018-01-02T15:30:00.000Z, 2018-01-02T15:45:00.000Z, 2018-01-02T16:00:00.000Z, 2018-01-02T16:30:00.000Z, 2018-01-02T16:45:00.000Z, 2018-01-02T17:00:00.000Z, 2018-01-02T17:30:00.000Z, 2018-01-02T17:45:00.000Z, 2018-01-02T18:00:00.000Z, 2018-01-02T18:30:00.000Z, 2018-01-02T18:45:00.000Z, 2018-01-02T19:00:00.000Z, 2018-01-02T19:30:00.000Z, 2018-01-02T19:45:00.000Z, 2018-01-02T20:00:00.000Z, 2018-01-02T20:30:00.000Z, 2018-01-02T20:45:00.000Z, 2018-01-02T21:00:00.000Z, 2018-01-02T21:30:00.000Z, 2018-01-02T21:45:00.000Z, 2018-01-02T22:00:00.000Z, 2018-01-02T22:30:00.000Z, 2018-01-02T22:45:00.000Z, 2018-01-02T23:00:00.000Z, 2018-01-02T23:30:00.000Z, 2018-01-02T23:45:00.000Z, 2018-01-03T00:00:00.000Z 
#> [parseValues] Parsing field phenomenonTime http://www.opengis.net/def/property/OGC/0/PhenomenonTime 
#> [parseValues] Using converter:
#> function(x, sos) {
#>   .t <- as.POSIXct(x = strptime(x = x, format = sosTimeFormat(sos = sos)))
#>   return(.t)
#> }
#> <bytecode: 0x518eb68>
#> <environment: namespace:sos4R>
#> [parseValues] Using converter function:
#> function(x, sos) {
#>   .t <- as.POSIXct(x = strptime(x = x, format = sosTimeFormat(sos = sos)))
#>   return(.t)
#> }
#> <bytecode: 0x518eb68>
#> <environment: namespace:sos4R>
#> [parseValues] Binding additional data.frame for phenomenonTime -- value range 2018-01-01 00:30:00, 2018-01-03 00:00:00 
#> [parseValues] Added column name: phenomenonTime 
#> [parseValues] The new bound data frame (one variable the a temp id):
#> 'data.frame':    144 obs. of  2 variables:
#>  $ tempID        : int  1 2 3 4 5 6 7 8 9 10 ...
#>  $ phenomenonTime: POSIXct, format: "2018-01-01 00:30:00" "2018-01-01 00:45:00" ...
#> [parseValues] Added attributes to new data: phenomenonTime, http://www.opengis.net/def/property/OGC/0/PhenomenonTime [ names:  name, definition ] 
#> [parseValues] Old attributes list is c("POSIXct", "POSIXt"),  
#> [parseValues] New attributes list is c("POSIXct", "POSIXt"), , phenomenonTime, http://www.opengis.net/def/property/OGC/0/PhenomenonTime 
#> [parseValues] Processing field index 2 of 2 
#> [parseValues] Current values:  990.0, 990.0, 990.0, 990.0, 990.0, 990.0, 990.0, 990.0, 990.0, 990.0, 990.0, 990.0, 991.0, 991.0, 991.0, 992.0, 992.0, 992.0, 993.0, 993.0, 993.0, 994.0, 994.0, 994.0, 994.0, 994.0, 994.0, 995.0, 995.0, 995.0, 994.0, 994.0, 994.0, 994.0, 994.0, 993.0, 993.0, 993.0, 993.0, 992.0, 992.0, 992.0, 991.0, 991.0, 991.0, 991.0, 990.0, 990.0, 990.0, 990.0, 990.0, 990.0, 990.0, 990.0, 989.0, 989.0, 989.0, 989.0, 989.0, 989.0, 989.0, 990.0, 990.0, 990.0, 990.0, 991.0, 991.0, 991.0, 992.0, 993.0, 993.0, 993.0, 993.0, 994.0, 994.0, 995.0, 995.0, 995.0, 996.0, 996.0, 996.0, 996.0, 997.0, 997.0, 997.0, 997.0, 998.0, 998.0, 998.0, 999.0, 999.0, 999.0, 1000.0, 1000.0, 1000.0, 1000.0, 1001.0, 1001.0, 1001.0, 1002.0, 1002.0, 1002.0, 1003.0, 1003.0, 1003.0, 1003.0, 1003.0, 1003.0, 1003.0, 1003.0, 1003.0, 1003.0, 1003.0, 1003.0, 1003.0, 1003.0, 1002.0, 1002.0, 1002.0, 1002.0, 1002.0, 1002.0, 1001.0, 1001.0, 1001.0, 1000.0, 1000.0, 1000.0, 999.0, 999.0, 998.0, 998.0, 997.0, 997.0, 996.0, 995.0, 995.0, 994.0, 993.0, 993.0, 992.0, 991.0, 991.0, 990.0 
#> [parseValues] Parsing field AthmosphericPressure AthmosphericPressure hPa 
#> [parseValues] Using converter:
#> NULL
#> [parseValues] Using converter function:
#> function(x, sos) {
#>   return(as.double(x = x))
#> }
#> <bytecode: 0x53a02d8>
#> <environment: namespace:sos4R>
#> [parseValues] Binding additional data.frame for AthmosphericPressure -- value range 989, 1003 
#> [parseValues] Added column name: AthmosphericPressure 
#> [parseValues] The new bound data frame (one variable the a temp id):
#> 'data.frame':    144 obs. of  3 variables:
#>  $ tempID              : int  1 2 3 4 5 6 7 8 9 10 ...
#>  $ phenomenonTime      : POSIXct, format: "2018-01-01 00:30:00" "2018-01-01 00:45:00" ...
#>  $ AthmosphericPressure: num  990 990 990 990 990 990 990 990 990 990 ...
#> [parseValues] Added attributes to new data: AthmosphericPressure, AthmosphericPressure, hPa [ names:  name, definition, unit of measurement ] 
#> [parseValues] Old attributes list is  
#> [parseValues] New attributes list is AthmosphericPressure, AthmosphericPressure, hPa 
#> [parseValues] Removing temporary first column
#> [parseValues] returning final data frame:
#> 'data.frame':    144 obs. of  2 variables:
#>  $ phenomenonTime      : POSIXct, format: "2018-01-01 00:30:00" "2018-01-01 00:45:00" ...
#>  $ AthmosphericPressure: num  990 990 990 990 990 990 990 990 990 990 ...
#>   ..- attr(*, "name")= chr "AthmosphericPressure"
#>   ..- attr(*, "definition")= chr "AthmosphericPressure"
#>   ..- attr(*, "unit of measurement")= chr "hPa"
#> [parseResult] Done
#> [parseTime] Entering
#> [parseTime] Found time instant
#> [parseTime] Done: GmlTimePosition [ time: 2018-01-01 01:00:00 ] 
#> [parseOM] Done parsing
#> [parseOM] Done parsing
#> [parseObservationCollection] Done. Processed 1 elements: ws2500_AthmosphericPressure_sf_C3C3285BCF1770CA697771FA167679B0895680C2 
#> [parseOM] Done parsing
#> [.getObservationById_1.0.0] Got OmObservationCollection ... calculating length with sosResult()[.getObservationById_1.0.0] result:  list(phenomenonTime = c(1514763000, 1514763900, 1514764800, 1514766600, 1514767500, 1514768400, 1514770200, 1514771100, 1514772000, 1514773800, 1514774700, 1514775600, 1514777400, 1514778300, 1514779200, 1514781000, 1514781900, 1514783700, 1514784600, 1514785500, 1514786400, 1514788200, 1514789100, 1514790000, 1514791800, 1514792700, 1514793600, 1514795400, 1514796300, 1514797200, 1514799000, 1514799900, 1514800800, 1514802600, 1514803500, 1514804400, 1514806200, 1514807100, 1514808000, 1514809800, 
#> 1514810700, 1514811600, 1514813400, 1514814300, 1514815200, 1514817000, 1514817900, 1514818800, 1514820600, 1514821500, 1514822400, 1514824200, 1514825100, 1514826000, 1514827800, 1514828700, 1514829600, 1514831400, 1514832300, 1514833200, 1514835000, 1514835900, 1514836800, 1514838600, 1514839500, 1514840400, 1514842200, 1514843100, 1514844000, 1514845800, 1514846700, 1514847600, 1514849400, 1514850300, 1514851200, 1514853000, 1514853900, 1514854800, 1514856600, 1514857500, 1514858400, 1514860200, 
#> 1514861100, 1514862000, 1514863800, 1514864700, 1514865600, 1514867400, 1514868300, 1514870100, 1514871000, 1514871900, 1514872800, 1514874600, 1514875500, 1514876400, 1514878200, 1514879100, 1514880000, 1514881800, 1514882700, 1514883600, 1514885400, 1514886300, 1514887200, 1514889000, 1514889900, 1514890800, 1514892600, 1514893500, 1514894400, 1514896200, 1514897100, 1514898000, 1514899800, 1514900700, 1514901600, 1514903400, 1514904300, 1514905200, 1514907000, 1514907900, 1514908800, 1514910600, 
#> 1514911500, 1514912400, 1514914200, 1514915100, 1514916000, 1514917800, 1514918700, 1514919600, 1514921400, 1514922300, 1514923200, 1514925000, 1514925900, 1514926800, 1514928600, 1514929500, 1514930400, 1514932200, 1514933100, 1514934000), AthmosphericPressure = c(990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 991, 991, 991, 992, 992, 992, 993, 993, 993, 994, 994, 994, 994, 994, 994, 995, 995, 995, 994, 994, 994, 994, 994, 993, 993, 993, 993, 992, 992, 992, 991, 991, 991, 991, 990, 
#> 990, 990, 990, 990, 990, 990, 990, 989, 989, 989, 989, 989, 989, 989, 990, 990, 990, 990, 991, 991, 991, 992, 993, 993, 993, 993, 994, 994, 995, 995, 995, 996, 996, 996, 996, 997, 997, 997, 997, 998, 998, 998, 999, 999, 999, 1000, 1000, 1000, 1000, 1001, 1001, 1001, 1002, 1002, 1002, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1002, 1002, 1002, 1002, 1002, 1002, 1001, 1001, 1001, 1000, 1000, 1000, 999, 999, 998, 998, 997, 997, 996, 995, 995, 994, 993, 993, 
#> 992, 991, 991, 990))[.getObservation_1.0.0] PARSED RESPONSE: OmObservationCollection 
#> [.getObservation_1.0.0] Result length(s):  144 
#> [sos4R] Finished getObservation to http://sensorweb.demo.52north.org/sensorwebtestbed/service/kvp 
#>  --> received 1 observation(s) having 144 result values [ 144 ].
#> Object of class OmObservationCollection with 1 members.

By using verboseOutput you can also debug the automatic GetCapabilities operation when creating a new SOS connection. That output is too extensive to show within this document.

Support

Feel free to ask questions about using the software or report a bug at the project issue tracker: https://github.com/52North/sos4R/issues. There you can also find existing bug reports and planned features.

Acknowledgements

The start of the project was generously supported by the 52°North Student Innovation Prize for Geoinformatics 2010. Thanks go also to Edzer Pebesma for contributing analyses to the demos at an early stage.

Outlook

In future releases a tighter integration is planned with the sf package regarding output data structures and classes.

References

  • Botts, M., 2007, OGC Implementation Specification 07-000: OpenGIS Sensor Model Language (SensorML)- Open Geospatial Consortium, Tech. Rep.
  • Bröring, A., C. Stasch, and J. Echterhoff. “OGC Interface Standard 10-037: SOS 2.0 Interface Standard.” Open Geospatial Consortium (2010).
  • Chambers, J.M., 2008, Software for Data Analysis, Programming with R. Springer, New York.
  • Na, A., Priest, M., Niedzwiadek, H. and Davidson, J., 2007, OGC Implementation Specification 06-009r6: Sensor Observation Service, http://portal.opengeospatial.org/files/?artifact_id=26667, Open Geospatial Consortium, Tech. Rep.
  • Nüst, D., Stasch, C. and Pebesma, E. J., 2011, Connecting R to the Sensor Web in Geertman, S., Reinhardt, W. and Toppen, F. (Eds.) Advancing Geoinformation Science for a Changing World, Springer Lecture Notes in Geoinformation and Cartography, doi: 10.1007/978-3-642-19789-5_12.