Learn R Programming

sos4R (version 0.4.2)

sosCreate: Convenience Functions for Request Parameter Creations

Description

These methods can be seen as convenience functions or shortcuts to regularly used parameters in GetObservation requests to a Sensor Observation Service. The remove some complexity and target the most common cases, but also limit flexibility.

NOTE: Whenever time objects are created from characters, note that functions may use your local timezone. All R time objects are UTC-based. All SOS queries use UTC timestamps. This can be confusing when you query data from an SOS located a different timezone or if the time stamp encoded in the request seems to mismatch your input at first glance. Therefore always check if the time period you retrieve matches what you need, and in general stick to using UTC time.

Usage

sosCreateBBOX(lowLat, lowLon, uppLat, uppLon, srsName, srsDimension = NA_integer_,
              axisLabels = NA_character_, uomLabels = NA_character_,
              propertyName = sosDefaultSpatialOpPropertyName)
sosCreateBBoxMatrix(lowLat, lowLon, uppLat, uppLon)
sosCreateFeatureOfInterest(objectIDs = list(NA), spatialOps = NULL, bbox = NULL,
                           srsName = NA_character_)
sosCreateEventTime(time, operator)
sosCreateEventTimeList(time, operator)
sosCreateTimeInstant(sos, time, frame = as.character(NA),
                     calendarEraName = as.character(NA),
                     indeterminatePosition = as.character(NA))
sosCreateTimePeriod(sos, begin, end, frame = as.character(NA),
                    calendarEraName = as.character(NA),
                    indeterminatePosition = as.character(NA),
                    duration = as.character(NA), timeInterval = NULL)
sosCreateTime(sos, time, operator = sosDefaultTemporalOperator)

Arguments

lowLat

Minimum latitude for bounding box and bounding box matrix.

lowLon

Minimum longitude for bounding box and bounding box matrix.

uppLat

Maximum latitude for bounding box and bounding box matrix.

uppLon

Maximum longitude for bounding box and bounding box matrix.

srsName

Name of the spatial reference system for bounding box, e.g. "urn:ogc:def:crs:EPSG:4326".

srsDimension

Dimensions of the spatial reference system, e.g. 2.

axisLabels

Labels of the axes of a bounding box as an ordered character vector.

uomLabels

Unit of measurement labels as an ordered character vector for the axes in a bounding box, e.g. "deg".

propertyName

The spatial property name for the bounding box, e.g. "urn:ogc:data:location"

objectIDs

Identifiers of a feature of interest list.

spatialOps

An object of class OgcSpatialOps-class which is inserted into the feature of interest element.

bbox

Shortcut to add a feature of interest with a GmlEnvelope-class, object must be a matrix as created by sosCreateBBoxMatrix(...).

time

Object of class "GmlTimeGeometricPrimitive" for sosCreateEventTimeList, or an object of class POSIXt for sosCreateTimePeriod,or an object of class character for sosCreateTime. Note that creating timestamps with as.POSIXct(..) will use your local timezone.

operator

The operator to be used for the time in sosCreateEventTimeList, e.g. "TM_During".

sos

An object of class SOS-class for which the element is created. The SOS might for example be required for formatting settings.

frame

Provides a URI reference that identifies a description of the reference system.

calendarEraName

The name of the calendar era.

begin

Object of class POSIXt. Note that creating timestamps with as.POSIXct(..) will use your local timezone.

end

Object of class POSIXt. Note that creating timestamps with as.POSIXct(..) will use your local timezone.

indeterminatePosition

Inexact temporal positions may be expressed using the optional indeterminatePosition parameter. This takes one of the following values: after, before, now, unknown.

duration

Duration of an interval using ISO 8601 syntax for temporal length.

timeInterval

An object of class "GmlTimeIntervalOrNULL" to be used in a GmlTimePeriod-class.

Value

An object of the respective class, or a list in case of sosEventTimeList.

Methods

signature(time = "GmlTimeGeometricPrimitive")

Create sos:time based on the given GmlTimeGeometricPrimitive.

signature(sos = "SOS", time = "POSIXt")

Create sos:time with time instant based on the given time.

signature(sos = "SOS", begin = "POSIXt", end = "POSIXt")

Create sos:time with time interval based on the given begin and end times.

See Also

These methods create object of the following classes: GmlTimeInstant-class, GmlTimePeriod-class, SosEventTime-class, SosFeatureOfInterest-class, OgcBBOX-class, matrix-class.

Examples

Run this code
# NOT RUN {
# 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])
print(foiObj)

# create a bounding box matrix and use it to create a spatial feature of interest
bboxMatrix <- sosCreateBBoxMatrix(lowLat = 50.0, lowLon = 7.0,
                                  uppLat = 53.0, uppLon = 10.0)
foiBBox <- sosCreateFeatureOfInterest(bbox = bboxMatrix,
                                      srsName = "urn:ogc:def:crs:EPSG:6.8:4326")
print(foiBBox)

# create a foi with a bounding box
bbox <- sosCreateBBOX(lowLat = 50.0, lowLon = 7.0, uppLat = 53.0, uppLon = 10.0,
                      srsName = "urn:ogc:def:crs:EPSG:6.8:4326",
                      srsDimension = as.integer(2), axisLabels = "lat,lon",
                      uomLabels = "deg,deg", propertyName = "bboxName")
foiBBox2 <- sosCreateFeatureOfInterest(spatialOps = bbox)
print(foiBBox2)

last.period <- sosCreateTimePeriod(sos = SOS_Test(),
	begin = (Sys.time() - 3600 * 24 * 7), end = Sys.time())

period <- sosCreateTimePeriod(sos = SOS_Test(),
		begin = as.POSIXct("2010/01/01"), end = as.POSIXct("2010/01/07"))
eventTime <- sosCreateEventTimeList(period)

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 = SOS_Test(), time = "::2007-08-05")
sosCreateTime(sos = SOS_Test(), time = "2007-08-05/")

# }

Run the code above in your browser using DataLab