GetResult

Introduction

The purpose of the GetResult operation is to allow a client to repeatedly obtain sensor data from the same set of sensors without having to send and receive requests and responses that largely contain the same data except for a new timestamp. A common use case is for a client to repeatedly request current sensor data from one or more sensors on a recurring basis. This operation supports that use case and allows it to occur using much less bandwidth than would be necessary for a full GetObservation call. The motivation for including the operation is to support a data center requesting data from a node that talks directly to sensors over a low bandwidth connection such as a 3G wireless link.

The GetResult operation relies on the creation of an O&M template from a previous call to GetObservation. The identifier of the template is used for subsequent GetResult calls instead of sending a duplicate GetObservation XML document. The response contains only the result portion of the O&M Observation because the other components are included by reference in the template. (SOS-Spec, OGC 06-009r6)

Example sequence

This is a typical sequence with examples for requests and reponses. The request can be excecuted with the test data from the test.sql and test_mobile.sql you can find in the db folder of your SOS.

1. Send GetObservation request with responseMode = "resultTemplate" (SOS-Spec, OGC 06-009r6)

  • Example request:
<?xml version="1.0" encoding="UTF-8"?>
<GetObservation xmlns="http://www.opengis.net/sos/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc"
 xmlns:om="http://www.opengis.net/om/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.opengis.net/sos/1.0
 http://schemas.opengis.net/sos/1.0.0/sosGetObservation.xsd"
 service="SOS" version="1.0.0" srsName="urn:ogc:def:crs:EPSG:4326">
   <offering>GAUGE_HEIGHT</offering>
   <observedProperty>urn:ogc:def:phenomenon:OGC:1.0.30:waterlevel</observedProperty>
   <responseFormat>text/xml;subtype=&quot;om/1.0.0&quot;</responseFormat>
   <responseMode>resultTemplate</responseMode>
</GetObservation>

2. SOS responds with a collection of Observation templates. There is one observation template per sensor that matches the query criteria. Each template has a GML name that is unique to the SOS server. Each template has a valid time period which acts like a lease. The template is no longer valid after the expiration and subsequent GetResult requests fail after the expiration. (SOS-Spec, OGC 06-009r6)

  • Example response:
<?xml version="1.0" encoding="UTF-8"?>
<om:ObservationCollection 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:swe="http://www.opengis.net/swe/1.0.1" gml:id="oc_0"
 xsi: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">
  <om:member>
    <om:Observation gml:id="ot_1">
      <om:samplingTime>
        <gml:TimePeriod xsi:type="gml:TimePeriodType">
          <gml:beginPosition>2009-04-22T13:11:22+02:00</gml:beginPosition>
          <gml:endPosition>2009-04-22T23:11:22+02:00</gml:endPosition>
        </gml:TimePeriod>
      </om:samplingTime>
      <om:procedure xlink:href="urn:ogc:object:feature:Sensor:IFGI:ifgi-sensor-1"/>
      <om:observedProperty>
        <swe:CompositePhenomenon gml:id="cpid0" dimension="1">
          <gml:name>resultComponents</gml:name>
          <swe:component xlink:href="urn:ogc:data:time:iso8601"/>
          <swe:component xlink:href="urn:ogc:def:phenomenon:OGC:1.0.30:waterlevel"/>
        </swe:CompositePhenomenon>
      </om:observedProperty>
      <om:featureOfInterest>
        <gml:FeatureCollection/>
      </om:featureOfInterest>
      <om:result>
        <swe:DataArray>
          <swe:elementCount>
            <swe:Count>
              <swe:value>0</swe:value>
            </swe:Count>
          </swe:elementCount>
          <swe:elementType name="Components">
            <swe:SimpleDataRecord>
              <swe:field name="Time">
                <swe:Time definition="urn:ogc:data:time:iso8601"/>
              </swe:field>
              <swe:field name="feature">
                <swe:Text definition="urn:ogc:data:feature"/>
              </swe:field>
              <swe:field name="waterlevel">
                <swe:Quantity definition="urn:ogc:def:phenomenon:OGC:1.0.30:waterlevel">
                  <swe:uom code="cm"/>
                </swe:Quantity>
              </swe:field>
            </swe:SimpleDataRecord>
          </swe:elementType>
          <swe:encoding>
            <swe:TextBlock decimalSeparator="." tokenSeparator="," blockSeparator=";"/>
          </swe:encoding>
          <swe:values/>
        </swe:DataArray>
      </om:result>
    </om:Observation>
  </om:member>
</om:ObservationCollection>

3. Send GetResult request with no time parameter or with an "after" time representing the latest time of an observation from the previous request. This allows the client to filter out duplicates and means the server does not need to maintain state for each GetResult request. (SOS-Spec, OGC 06-009r6)

  • Example request (no time filter):
<sos:GetResult xmlns:sos="http://www.opengis.net/sos/1.0" service="SOS" version="1.0.0">
   <sos:ObservationTemplateId>ot_1</sos:ObservationTemplateId>
</sos:GetResult>

  • Example request (time filter):
<sos:GetResult xmlns:sos="http://www.opengis.net/sos/1.0" service="SOS" version="1.0.0">
   <sos:ObservationTemplateId>ot_1</sos:ObservationTemplateId>
   <sos:eventTime>
      <ogc:TM_After>
         <ogc:PropertyName>om:samplingTime</ogc:PropertyName>
         <gml:TimeInstant>
            <gml:timePosition>2008-04-01T17:47:00+02</gml:timePosition>
         </gml:TimeInstant>
      </ogc:TM_After>
   </sos:eventTime>
</sos:GetResult>

4. SOS responds with result(s) including all observations available since the begin time of the lease. (SOS-Spec, OGC 06-009r6)

  • Example response:
<?xml version="1.0" encoding="UTF-8"?>
<ns:GetResultResponse xmlns:ns="http://www.opengis.net/sos/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosAll.xsd">
  <ns:result RS="ot_1">
    2008-04-01T17:44:00+02,foi_1001,50.0;2008-04-01T17:45:00+02,foi_1001,40.2;
    2008-04-01T17:46:00+02,foi_1001,70.4;2008-04-01T17:47:00+02,foi_1001,60.5;
    2008-04-01T17:48:00+02,foi_1001,45.456;2008-04-01T17:49:00+02,foi_1001,110.1213;
  </ns:result>
</ns:GetResultResponse>

For more information about the supportet filters look at SensorObservationService main page or at the SOS specification.

-- CarstenHollmann - 22 Apr 2009
Topic revision: r2 - 22 Apr 2009, CarstenHollmann
Legal Notice | Privacy Statement


This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback