Description Usage Arguments Details Value References Examples
These values are default parameters and handling functions for connections and requests to, as well as response processing of answers from, Sensor Observation Services. These allow to simplify a SOS connection for the most common use cases and non-expert users.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | SosDefaultBinding()
SosParsingFunctions(..., include = character(0), exclude = character(0))
SosEncodingFunctions(..., include = character(0), exclude = character(0))
SosDataFieldConvertingFunctions(..., include = character(0), exclude = character(0))
SosDisabledParsers()
SosDefaults()
SosResetParsingFunctions(sos)
SosDefaultDCPs()
SosDefaultParsingOptions()
|
... |
Named references to functions to be used for the respective element during parsing, encoding or conversion, e.g. |
include |
A list of names of elements whose functions shall be included in the returned list, e.g. |
exclude |
A list of names of elements whose functions shall be excluded in the returned list, e.g. |
sos |
An object of class |
The default values are strongly related to what is actually implemented in the package, but also often resemble the (hopefully) most common use cases.
Some defaults are accessed directly, others should be accessed using a function. The latter is required for cases where a runtime evaluation is needed, e.g. for default values of construction functions.
A special case are the functions to access the default functions for specific purposes, which are the parsing functions, the encoding functions and the field converting functions. See the examples on how to use them.
The function SosDisabledParsers
can be used to use no parsing at all (despite the parsing for the capabilities response, which is required for establishing a connection to a SOS. This function is helpful to inspect the unprocessed responses from a service.
The function SosResetParsingFunctions
can be used to replace the included parsing functions of a SOS
object with the default ones. This is even useful for development of the default parsing functions.
The default parameter values are:
\Sexpr[results=verbatim,stage=render]{sosDefaultCharacterEncoding}
\Sexpr[results=text,stage=render]{sosDefaultDescribeSensorOutputFormat}
\Sexpr[results=text,stage=render]{sosDefaultGetCapSections}
\Sexpr[results=text,stage=render]{sosDefaultGetCapAcceptFormats}
\Sexpr[results=text,stage=render]{sosDefaultGetCapOwsVersion}
\Sexpr[results=text,stage=render]{sosDefaultGetObsResponseFormat}
\Sexpr[results=text,stage=render]{sosDefaultTimeFormat}
\Sexpr[results=text,stage=render]{sosDefaultFilenameTimeFormat}
\Sexpr[results=text,stage=render]{sosDefaultTempOpPropertyName}
\Sexpr[results=text,stage=render]{sosDefaultTemporalOperator}
\Sexpr[results=text,stage=render]{sosDefaultSpatialOpPropertyName}
The default parsing functions can be replaced for a variety of XML elements, so that you only need to replace the parts of the parsing that really must be changed. Be aware that inclusion and exclusion are performed after merging the given functions with the defaults!
Example Services: This list contains a few SOS instances that were tested (to different degress) with sos4R. The package authors do not maintain these services, so no guarantee can be given that these are usable.
The default value of the respective setting or parameter. This can be a list, especially a named list of functions.
Constants
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # simple default values
show(sosDefaultCharacterEncoding)
show(sosDefaultDescribeSensorOutputFormat)
show(sosDefaultGetCapAcceptFormats)
show(sosDefaultGetCapOwsVersion)
show(sosDefaultGetCapSections)
show(sosDefaultGetObsResponseFormat)
show(sosDefaultSpatialOpPropertyName)
show(sosDefaultTempOpPropertyName)
show(sosDefaultTemporalOperator)
show(sosDefaultTimeFormat)
SosDefaultBinding()
## Not run:
# usage of defaults in construction method for SOS class
sos <- SOS("http://mysos.com/sos", binding = SosDefaultBinding(),
timeFormat = sosDefaultTimeFormat)
# functions to disable all parsing
SosDisabledParsers()
## End(Not run)
# Replace a parsing function
myER <- function(xml) {
return("EXCEPTION!!!11")
}
myParsingFunctions <- SosParsingFunctions("ExceptionReport" = myER)
# use inclusion and exclusion, important: even the just added function needs to
# be included manually!
myParsingFunctions <- SosParsingFunctions("ExceptionReport" = myER,
include = c("GetObservation", "DescribeSensor", "ExceptionReport"))
myParsingFunctions <- SosParsingFunctions(exclude = c("GetObservation", "DescribeSensor"))
## Not run:
# Replace an encoding function
myEncoding <- function(object, v) {
return(utils::str(object))
}
sos = SOS(url = "http://mysos.com/sos",
encoders = SosEncodingFunctions("POST" = myPostEncoding))
# 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)
# inspecting XML using dummy parsing function
sos = SOS(url = "http://mysos.com/sos", parsers = SosDisabledParsers)
describeSensor(sos, sosProcedures(sos)[[1]])
# replace the parsing functions with the default ones
sos <- SosResetParsingFunctions(sos)
## End(Not run)
# a named list of all defaults
SosDefaults()
# parsing options used by xml2
SosDefaultParsingOptions()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.