Difference between revisions of "Sensor Observation Service (SOS)"
Ptagliolato (Talk | contribs) |
(→Registrazione di sensori (RegisterSensor)) |
||
Line 92: | Line 92: | ||
<sml:input name="CPIn"> | <sml:input name="CPIn"> | ||
<swe:ObservableProperty definition="urn:ogc:def:property:OGC:1.0.30:CP_in"/> | <swe:ObservableProperty definition="urn:ogc:def:property:OGC:1.0.30:CP_in"/> | ||
− | |||
− | |||
− | |||
</sml:input> | </sml:input> | ||
</sml:InputList> | </sml:InputList> | ||
Line 106: | Line 103: | ||
<sml:output name="CP"> | <sml:output name="CP"> | ||
<swe:Quantity definition="urn:ogc:def:property:OGC:1.0.30:CP"> | <swe:Quantity definition="urn:ogc:def:property:OGC:1.0.30:CP"> | ||
− | <gml:metaDataProperty><offering><id>CP</id><name>Chlorophyll</name></offering></gml:metaDataProperty> | + | <gml:metaDataProperty> |
+ | <offering> | ||
+ | <id>CP</id> | ||
+ | <name>Chlorophyll</name> | ||
+ | </offering> | ||
+ | </gml:metaDataProperty> | ||
<swe:uom code="ug/l"/> | <swe:uom code="ug/l"/> | ||
</swe:Quantity> | </swe:Quantity> |
Revision as of 16:59, 5 February 2014
Server SOS utilizzato: 52North versione 3.2 (NOTA: implementa versione OGC SOS 1.0.0 - cf. Arthur Na (IRIS Corp.), Mark Priest (3eTI) OGC 06-009r6.)
Prerequisiti: postgres fino <= 9.0, postgis <= 1.5
...
Contents
Esempi di requests validati:
Registrazione di sensori (RegisterSensor)
<?xml version="1.0" encoding="UTF-8"?> <RegisterSensor service="SOS" version="1.0.0" xmlns="http://www.opengis.net/sos/1.0" xmlns:swe="http://www.opengis.net/swe/1.0.1" xmlns:ows="http://www.opengeospatial.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:om="http://www.opengis.net/om/1.0" xmlns:sml="http://www.opengis.net/sensorML/1.0.1" 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/sosRegisterSensor.xsd http://www.opengis.net/om/1.0 http://schemas.opengis.net/om/1.0.0/extensions/observationSpecialization_override.xsd"> <SensorDescription> <sml:SensorML version="1.0.1"> <sml:member> <sml:System xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <sml:identification> <sml:IdentifierList> <sml:identifier> <sml:Term definition="urn:ogc:def:identifier:OGC:uniqueID"> <sml:value>urn:ogc:object:feature:Sensor:SI001137-P06:CP</sml:value> </sml:Term> </sml:identifier> </sml:IdentifierList> </sml:identification> <sml:capabilities> <swe:SimpleDataRecord> <swe:field name="status"> <swe:Boolean> <swe:value>true</swe:value> </swe:Boolean> </swe:field> <swe:field name="mobile"> <swe:Boolean> <swe:value>true</swe:value> </swe:Boolean> </swe:field> </swe:SimpleDataRecord> </sml:capabilities> <sml:position name="sensorPosition"> <swe:Position referenceFrame="urn:ogc:def:crs:EPSG::4326"> <swe:location> <swe:Vector gml:id="STATION_LOCATION"> <swe:coordinate name="easting"> <swe:Quantity> <swe:uom code="degree"/> <swe:value>8.65647</swe:value> </swe:Quantity> </swe:coordinate> <swe:coordinate name="northing"> <swe:Quantity> <swe:uom code="degree"/> <swe:value>45.96648</swe:value> </swe:Quantity> </swe:coordinate> <swe:coordinate name="altitude"> <swe:Quantity> <swe:uom code="m"/> <swe:value>194.0</swe:value> </swe:Quantity> </swe:coordinate> </swe:Vector> </swe:location> </swe:Position> </sml:position> <sml:inputs> <sml:InputList> <sml:input name="CPIn"> <swe:ObservableProperty definition="urn:ogc:def:property:OGC:1.0.30:CP_in"/> </sml:input> </sml:InputList> </sml:inputs> <sml:outputs> <sml:OutputList> <sml:output name="CP"> <swe:Quantity definition="urn:ogc:def:property:OGC:1.0.30:CP"> <gml:metaDataProperty> <offering> <id>CP</id> <name>Chlorophyll</name> </offering> </gml:metaDataProperty> <swe:uom code="ug/l"/> </swe:Quantity> </sml:output> <sml:output name="Depth"> <swe:Quantity definition="urn:ogc:def:property:OGC:1.0.30:pressure"> <gml:metaDataProperty> <offering> <id>CP</id><name>Depth</name> </offering> </gml:metaDataProperty> <swe:uom code="m"/> </swe:Quantity> </sml:output> </sml:OutputList> </sml:outputs> </sml:System> </sml:member> </sml:SensorML> </SensorDescription> <ObservationTemplate> <om:Observation> <om:samplingTime></om:samplingTime> <om:procedure></om:procedure> <om:observedProperty></om:observedProperty> <om:featureOfInterest></om:featureOfInterest> <om:result></om:result> </om:Observation> </ObservationTemplate> </RegisterSensor>
Inserimento di osservazioni (InsertObservation)
<?xml version="1.0"?> <InsertObservation xsi:schemaLocation="http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosInsert.xsd http://www.opengis.net/sampling/1.0 http://schemas.opengis.net/sampling/1.0.0/sampling.xsd http://www.opengis.net/om/1.0 http://schemas.opengis.net/om/1.0.0/extensions/observationSpecialization_override.xsd" service="SOS" version="1.0.0"xmlns="http://www.opengis.net/sos/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:ogc="http://www.opengis.net/ogc" xmlns:om="http://www.opengis.net/om/1.0" xmlns:sos="http://www.opengis.net/sos/1.0" xmlns:sa="http://www.opengis.net/sampling/1.0" xmlns:gml="http://www.opengis.net/gml" xmlns:swe="http://www.opengis.net/swe/1.0.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <AssignedSensorId>urn:ogc:object:feature:Sensor:SI001137-P06:CP</AssignedSensorId> <om:Observation> <om:samplingTime> <gml:TimePeriod xsi:type="gml:TimePeriodType"> <gml:beginPosition>1981-01-15T10:02:00+01</gml:beginPosition> <gml:endPosition>2011-12-15T10:02:00+01</gml:endPosition> </gml:TimePeriod> </om:samplingTime> <om:procedure xlink:href="urn:ogc:object:feature:Sensor:SI001137-P06:CP"/> <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:property:OGC:1.0.30:CP"/> <swe:component xlink:href="urn:ogc:def:property:OGC:1.0.30:pressure"/> </swe:CompositePhenomenon> </om:observedProperty> <om:featureOfInterest> <sa:SamplingPoint gml:id="SI001137-P06"> <gml:name>SI001137-P06</gml:name> <sa:sampledFeature xlink:href=""/> <sa:position> <gml:Point> <gml:pos srsName="urn:ogc:def:crs:EPSG::4326">45.96648 8.65647</gml:pos> </gml:Point> </sa:position> </sa:SamplingPoint> </om:featureOfInterest> <om:result> <swe:DataArray> <swe:elementCount> <swe:Count> <swe:value>2</swe:value> </swe:Count> </swe:elementCount> <swe:elementType name="Components"> <swe:DataRecord> <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="CP"> <swe:Quantity definition="urn:ogc:def:property:OGC:1.0.30:CP"> <swe:uom code="ug/l"/> </swe:Quantity> </swe:field> <swe:field name="Depth"> <swe:Quantity definition="urn:ogc:def:property:OGC:1.0.30:pressure"> <swe:uom code="m"/> </swe:Quantity> </swe:field> </swe:DataRecord> </swe:elementType> <swe:encoding> <swe:TextBlock decimalSeparator="." tokenSeparator="," blockSeparator=";"/> </swe:encoding> <swe:values>1997-12-15T10:02:00+01,SI001137-P06,0.83,-10;1991-05-15T10:02:00+01,SI001137-P06,6.03,-10;</swe:values> </swe:DataArray> </om:result> </om:Observation> </InsertObservation>
Richiesta di osservazioni (GetObservation)
script curl request sos
- !/bin/bash
- PURPOSE: call irea SOS service given post request file(name)
- USAGE: <script name> <post request filename>
- the script writes the response content in the working directory and opens it with the default xml editor
- AUTHOR: tagliolato.p@irea.cnr.it
display_help() { echo "Usage: $(basename $0) [-h] [-a <application>] <sos request file>" echo "-a open resulting xml within the given application" echo "-h display help" }
- check envir
for tool in getopts curl open; do if ! type $tool >/dev/null 2>&1; then echo " ERROR: \"$tool\" not found." >&2 echo " This is needed by $(basename $0) to work. Check your" >&2 echo " \$PATH variable or install the tool \"$tool\"." >&2 echo " try the following:" echo " export PATH=\"\$PATH:/usr/local/pgsql/bin\" " exit 2 fi done
while getopts "a:h" opt; do
case $opt in a) OPEN="apri" XMLApp="$OPTARG" if [ "$XMLApp" = "" ] then echo "OPEN WITH default XML application" else
echo "OPEN WITH = $XMLApp" fi
shift $((OPTIND-1)) ;; h) display_help exit 0 ;; \?) echo " Invalid option: -$OPTARG" >&2 display_help && exit 2 ;; esac
done
- check input
echo "OPEN= $OPEN" if [ "$1" == "" ] then display_help echo " input mancante $1" >&2 #echo "$@" >&2 exit 1 else if [ -f $1 ] then curl -X POST -d @$1 http://sp7.irea.cnr.it/tomcat/SOS32/sos --header "Content-Type:text/xml" > $1.SOS32.response.xml if [ "$OPEN" == "apri" ] then if [ "$XMLApp" != "" ] then open $1.SOS32.response.xml -a $XMLApp else open $1.SOS32.response.xml fi fi else echo " la risorsa $1 non esiste" >&2 exit 2 fi fi