Defaults.Rd
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.
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.
# simple default values show(sosDefaultCharacterEncoding)#> [1] "UTF-8"show(sosDefaultDescribeSensorOutputFormat)#> [1] "text/xml;subtype=\"sensorML/1.0.1\""show(sosDefaultGetCapAcceptFormats)#> [1] "text/xml"show(sosDefaultGetCapOwsVersion)#> [1] "1.1.0"show(sosDefaultGetCapSections)#> [1] "All"show(sosDefaultGetObsResponseFormat)#> [1] "text/xml;subtype=\"om/1.0.0\""show(sosDefaultSpatialOpPropertyName)#> [1] "urn:ogc:data:location"show(sosDefaultTempOpPropertyName)#> [1] "om:samplingTime"show(sosDefaultTemporalOperator)#> [1] "TM_During"show(sosDefaultTimeFormat)#> [1] "%Y-%m-%dT%H:%M:%OS%z"SosDefaultBinding()#> [1] "POX"if (FALSE) { # 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() } # 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")) if (FALSE) { # 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) } # a named list of all defaults SosDefaults()#> $sosDefaultCharacterEncoding #> [1] "UTF-8" #> #> $sosDefaultDescribeSensorOutputFormat #> [1] "text/xml;subtype=\"sensorML/1.0.1\"" #> #> $sosDefaultGetCapSections #> [1] "All" #> #> $sosDefaultGetCapAcceptFormats #> [1] "text/xml" #> #> $sosDefaultGetCapOwsVersion #> [1] "1.1.0" #> #> $sosDefaultGetObsResponseFormat #> [1] "text/xml;subtype=\"om/1.0.0\"" #> #> $sosDefaultTimeFormat #> [1] "%Y-%m-%dT%H:%M:%OS%z" #> #> $sosDefaultFilenameTimeFormat #> [1] "%Y-%m-%d_%H-%M-%OS" #> #> $sosDefaultTempOpPropertyName #> [1] "om:samplingTime" #> #> $sosDefaultTemporalOperator #> [1] "TM_During" #> #> $sosDefaultSpatialOpPropertyName #> [1] "urn:ogc:data:location" #> #> $sosDefaultColumnNameFeatureIdentifier #> [1] "feature" #> #> $sosDefaultColumnNameLat #> [1] "lat" #> #> $sosDefaultColumnNameLon #> [1] "lon" #> #> $sosDefaultColumnNameSRS #> [1] "SRS" #> #> $sosDefaultReferenceFrameSensorDescription #> [1] "urn:ogc:def:crs:EPSG:4326" #># parsing options used by xml2 SosDefaultParsingOptions()#> [1] "RECOVER"