# Tests using the 52North demo service >>> from owslib.sos import SensorObservationService >>> service = SensorObservationService('http://sensorweb.demo.52north.org/52n-sos-webapp/sos/kvp',version='2.0.0') >>> for content in sorted(service.contents): ... print(content) ... http://www.52north.org/test/offering/1 http://www.52north.org/test/offering/2 http://www.52north.org/test/offering/3 http://www.52north.org/test/offering/4 http://www.52north.org/test/offering/5 http://www.52north.org/test/offering/6 http://www.52north.org/test/offering/7 http://www.52north.org/test/offering/8 http://www.52north.org/test/offering/developer >>> id = service.identification # Check basic service metadata >>> id.service 'OGC:SOS' >>> id.title '52N SOS' >>> provider=service.provider >>> provider.name '52North' >>> len(service.operations) 16 # Check allowed params for get FOI >>> get_foi=service.get_operation_by_name('GetFeatureOfInterest') >>> try: ... x = unicode('test') ... for x in sorted(get_foi.parameters['featureOfInterest']['values']): ... print(x.encode('utf8')) ... except: ... for x in sorted(get_foi.parameters['featureOfInterest']['values']): ... print(x) http://www.52north.org/test/featureOfInterest/1 http://www.52north.org/test/featureOfInterest/2 http://www.52north.org/test/featureOfInterest/3 http://www.52north.org/test/featureOfInterest/4 http://www.52north.org/test/featureOfInterest/5 http://www.52north.org/test/featureOfInterest/6 http://www.52north.org/test/featureOfInterest/7 http://www.52north.org/test/featureOfInterest/8 http://www.52north.org/test/featureOfInterest/Heiden http://www.52north.org/test/featureOfInterest/Münster/FE101 http://www.52north.org/test/featureOfInterest/Portland http://www.52north.org/test/featureOfInterest/TODO http://www.52north.org/test/featureOfInterest/world # Check allowed params for get observation >>> get_obs=service.get_operation_by_name('GetObservation') get_obs.parameters['responseFormat']['values'] ['http://www.opengis.net/om/2.0'] # Get observation call # Get latest value using O&M reponse format #'\n\n \n \n \n \n \n 2014-07-10T04:31:58.000Z\n \n \n \n \n \n \n 17.2\n \n \n' >>> 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)