# NOT RUN {
# }
# NOT RUN {
# Open the connection
sos = SOS(url = "<the service endpoint>")
# List offerings, procedures and observedProperties
names(sosOfferings(sos))
sosProcedures(sos)
sosObservedProperties(sos)
# Create time period (last 30 days)
tPeriod <- sosCreateEventTimeList(
time = sosCreateTimePeriod(
sos = pegelsos,
begin = Sys.time() - (3600 * 24 * 30),
end = Sys.time()))
# Request data for all observed properties and procedures of a certain offering
observation <- getObservation(sos = sos,
observedProperty = sosObservedProperties(sos),
offering = sosOfferings(sos)[[2]],
procedure = sosProcedures(sos),
eventTime = tPeriod)
# Inspect result
sosResult(observation)
utils::str(sosResult(observation))
# Inspect attributes of the data fields
if(is.list(sosResult(observation))) {
attributes(sosResult(observation)[,1])
}
else {
attributes(sosResult(pegelObs)[,1])
}
# Use custom converting function and connection method. This mechanism works the
# same for encoders and decoders.
myConverters <- SosDataFieldConvertingFunctions(
"myNumericUnit" = sosConvertDouble)
mySos <- SOS(sos.url, binding = "KVP", dataFieldConverters = myConverters)
sosDataFieldConverters(mySos)
# where to find the cheat sheet
sosCheatSheet()
# global objects caching objects during parsing of XML documents
cacheVariables
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab