CSM:XML measurement observation

From its-wiki.no

Jump to: navigation, search
XML measurement observation
Home Toolbox Usage examples About us
English-Language-icon.png

Code examples for uploading data

As it shown above figure, the SEDS platform offers two types of observations to be received and stored on the storage, being:-

  • Measurement
  • Questionnaire

The measurement object is used for storing less complex observations with values as decimals. An example for XML format used to send measurements observations from a sensor to the SEDS platform is provided here.


<?xml version="1.0"?>
<wfs:Transaction version="2.0.0" service="WFS" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cts="http:www.citi-sense.eu/citisense"
xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:gss="http://www.isotc211.org/2005/gss" xmlns:gts="http://www.isotc211.org/2005/gts"
xmlns:gsr="http://www.isotc211.org/2005/gsr" xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:fes="http://www.opengis.net/fes/2.0">
   <wfs:Insert>
       <cts:Observation gml:id="LOCAL_ID_0">
           <cts:sensorID xlink:href="#CITISENSE-Test-00000004"/>
           <cts:contains>
               <cts:Measurement>
                   <cts:measurementID>1</cts:measurementID>
                   <cts:value>10</cts:value>
                   <cts:uom>ppb</cts:uom>
                   <cts:observedProperty>NO2</cts:observedProperty>
                   <cts:measuretime>2001-12-17T09:30:47Z</cts:measuretime>
                   <cts:latitude>3.141</cts:latitude>
                   <cts:longitude>3.1415</cts:longitude>
               </cts:Measurement>
           </cts:contains>
           <cts:contains>
               <cts:Measurement>
                   <cts:measurementID>2</cts:measurementID>
                   <cts:value>16532</cts:value>
                   <cts:uom>ppb</cts:uom>
                   <cts:observedProperty>NO2</cts:observedProperty>
                   <cts:measuretime>2001-12-17T09:30:47Z</cts:measuretime>
                   <cts:latitude>3.141</cts:latitude>
                   <cts:longitude>3.1415</cts:longitude>
               </cts:Measurement>
           </cts:contains>
           <cts:observationID>2</cts:observationID>
           <cts:starttime>2001-12-17T09:30:47Z</cts:starttime>
           <cts:finishtime>2001-12-17T09:30:47Z</cts:finishtime>
           <cts:participantID>test_testID1</cts:participantID>
       </cts:Observation>
   </wfs:Insert>
</wfs:Transaction>

The questionnaire object gives the possibility to store more complex data sets and can contain both question and answer with detailed information about the questionnaire and the questions asked. Below is XML format to register questionnaire observations with answer (which sent usually from mobile app).

<?xml version="1.0"?>
<wfs:Transaction version="2.0.0" service="WFS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cts="http:www.citi-sense.eu/citisense" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gss="http://www.isotc211.org/2005/gss" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gsr="http://www.isotc211.org/2005/gsr" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:fes="http://www.opengis.net/fes/2.0">
   <wfs:Insert>
       <cts:Observations gml:id="LOCAL_ID_0">
           <cts:canHave>
               <cts:Questionnaire>
                   <cts:includes>
                       <cts:Question>
                           <cts:has>
                               <cts:Response>
                                   <cts:idresponse>1</cts:idresponse>
                                   <cts:source>xxx</cts:source>
                                   <cts:timestamp>2014-02-14T10:23:00.000</cts:timestamp>
                               </cts:Response>
                           </cts:has>
                           <cts:needs>
                               <cts:Answer>
                                   <cts:idanswer>1</cts:idanswer>
                                   <cts:value>blablablablablabla</cts:value>
                               </cts:Answer>
                           </cts:needs>
                           <cts:idquestion>1</cts:idquestion>
                           <cts:parent_id>1</cts:parent_id>
                           <cts:order>1</cts:order>
                           <cts:type>xxx</cts:type>
                           <cts:label>xxx</cts:label>
                           <cts:maxlength>123</cts:maxlength>
                           <cts:values>xxx</cts:values>
                           <cts:required>123</cts:required>
                           <cts:rtl>123</cts:rtl>
                       </cts:Question>
                   </cts:includes>
                   <cts:idquestionnaire>1</cts:idquestionnaire>
                   <cts:url>http:\/\/citisense.u-hopper.com\/img\/logo.jpg</cts:url>
                   <cts:title>xxx</cts:title>
                   <cts:description>xxx</cts:description>
                   <cts:rlt>123</cts:rlt>
                   <cts:campaign_id>123</cts:campaign_id>
                   <cts:created>2014-02-14T10:23:00.000</cts:created>
                   <cts:updated>2014-02-14T10:23:00.000</cts:updated>
               </cts:Questionnaire>
           </cts:canHave>
           <cts:cityId xlink:href="#5"/>
           <cts:sensorId xlink:href="#3"/>
           <cts:idobservation>4</cts:idobservation>
           <cts:starttime>2014-02-14T10:23:00.000</cts:starttime>
           <cts:finishtime>2014-02-14T10:23:00.000</cts:finishtime>
       </cts:Observations>
   </wfs:Insert>
</wfs:Transaction>