| 1 |
# Tests using the 52North demo service |
| 2 |
|
| 3 |
>>> from owslib.sos import SensorObservationService |
| 4 |
>>> service = SensorObservationService('http://sensorweb.demo.52north.org/52n-sos-webapp/sos/kvp',version='2.0.0') |
| 5 |
>>> for content in sorted(service.contents): |
| 6 |
... print(content) |
| 7 |
... |
| 8 |
http://www.52north.org/test/offering/1 |
| 9 |
http://www.52north.org/test/offering/2 |
| 10 |
http://www.52north.org/test/offering/3 |
| 11 |
http://www.52north.org/test/offering/4 |
| 12 |
http://www.52north.org/test/offering/5 |
| 13 |
http://www.52north.org/test/offering/6 |
| 14 |
http://www.52north.org/test/offering/7 |
| 15 |
http://www.52north.org/test/offering/8 |
| 16 |
http://www.52north.org/test/offering/developer |
| 17 |
|
| 18 |
>>> id = service.identification |
| 19 |
|
| 20 |
# Check basic service metadata |
| 21 |
>>> id.service |
| 22 |
'OGC:SOS' |
| 23 |
|
| 24 |
>>> id.title |
| 25 |
'52N SOS' |
| 26 |
|
| 27 |
>>> provider=service.provider |
| 28 |
>>> provider.name |
| 29 |
'52North' |
| 30 |
|
| 31 |
>>> len(service.operations) |
| 32 |
16 |
| 33 |
|
| 34 |
# Check allowed params for get FOI |
| 35 |
|
| 36 |
>>> get_foi=service.get_operation_by_name('GetFeatureOfInterest') |
| 37 |
>>> try: |
| 38 |
... x = unicode('test') |
| 39 |
... for x in sorted(get_foi.parameters['featureOfInterest']['values']): |
| 40 |
... print(x.encode('utf8')) |
| 41 |
... except: |
| 42 |
... for x in sorted(get_foi.parameters['featureOfInterest']['values']): |
| 43 |
... print(x) |
| 44 |
http://www.52north.org/test/featureOfInterest/1 |
| 45 |
http://www.52north.org/test/featureOfInterest/2 |
| 46 |
http://www.52north.org/test/featureOfInterest/3 |
| 47 |
http://www.52north.org/test/featureOfInterest/4 |
| 48 |
http://www.52north.org/test/featureOfInterest/5 |
| 49 |
http://www.52north.org/test/featureOfInterest/6 |
| 50 |
http://www.52north.org/test/featureOfInterest/7 |
| 51 |
http://www.52north.org/test/featureOfInterest/8 |
| 52 |
http://www.52north.org/test/featureOfInterest/Heiden |
| 53 |
http://www.52north.org/test/featureOfInterest/Münster/FE101 |
| 54 |
http://www.52north.org/test/featureOfInterest/Portland |
| 55 |
http://www.52north.org/test/featureOfInterest/TODO |
| 56 |
http://www.52north.org/test/featureOfInterest/world |
| 57 |
|
| 58 |
# Check allowed params for get observation |
| 59 |
|
| 60 |
>>> get_obs=service.get_operation_by_name('GetObservation') |
| 61 |
get_obs.parameters['responseFormat']['values'] |
| 62 |
['http://www.opengis.net/om/2.0'] |
| 63 |
|
| 64 |
# Get observation call |
| 65 |
|
| 66 |
# Get latest value using O&M reponse format |
| 67 |
|
| 68 |
#'<?xml version="1.0" encoding="UTF-8"?>\n<sos:GetObservationResponse xmlns:sos="http://www.opengis.net/sos/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:om="http://www.opengis.net/om/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sos/2.0 http://schemas.opengis.net/sos/2.0/sosGetObservation.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd http://www.opengis.net/om/2.0 http://schemas.opengis.net/om/2.0/observation.xsd">\n <sos:observationData>\n <om:OM_Observation gml:id="o_729058FD6AAFC4701C83D125175F889F51FD4798">\n <om:type xlink:href="http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement"/>\n <om:phenomenonTime>\n <gml:TimeInstant gml:id="phenomenonTime_2118549">\n <gml:timePosition>2014-07-10T04:31:58.000Z</gml:timePosition>\n </gml:TimeInstant>\n </om:phenomenonTime>\n <om:resultTime xlink:href="#phenomenonTime_2118549"/>\n <om:procedure xlink:href="http://geoviqua.dev.52north.org/procedures/WXT520"/>\n <om:observedProperty xlink:href="http://geoviqua.dev.52north.org/properties/AirTemperature"/>\n <om:featureOfInterest xlink:href="http://geoviqua.dev.52north.org/stations/Vaisala-WXT520" xlink:title="Vaisala_WXT520"/>\n <om:result xmlns:ns="http://www.opengis.net/gml/3.2" uom="degC" xsi:type="ns:MeasureType">17.2</om:result>\n </om:OM_Observation>\n </sos:observationData>\n</sos:GetObservationResponse>' |
| 69 |
>>> latest_response = service.get_observation('http://www.opengis.net/om/2.0', ['http://www.52north.org/test/offering/1'], ['http://www.52north.org/test/observableProperty/1'], eventTime='om:phenomenonTime,latest', timeout=120) |