source: TI02-CSML/trunk/services/3rdParty/OWSLib-0.2.0/tests/JPLCapabilities.txt @ 2194

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/services/3rdParty/OWSLib-0.2.0/tests/JPLCapabilities.txt@2194
Revision 2194, 4.2 KB checked in by lawrence, 13 years ago (diff)

Adding various specs and 3rd party code of interest for the CSML
services development.

RevLine 
[2194]1
2Imports
3
4    >>> from owslib.wms import WebMapService
5   
6Fake a request to a WMS Server using saved doc from
7http://wms.jpl.nasa.gov/wms.cgi.
8
9    >>> xml = open('JPLCapabilities.xml', 'r').read()
10    >>> wms = WebMapService('url', version='1.1.1', xml=xml)
11   
12Test capabilities
13-----------------
14
15    >>> wms.capabilities.service
16    'OGC:WMS'
17
18    >>> wms.capabilities.title
19    'JPL Global Imagery Service'
20   
21    >>> wms.capabilities.abstract
22    'WMS Server maintained by JPL, worldwide satellite imagery.'
23   
24    >>> wms.capabilities.link
25    'http://OnEarth.jpl.nasa.gov/index.html'
26   
27    >>> wms.capabilities.keywords
28    ['ImageryBaseMapsEarthCover', 'Imagery', 'BaseMaps', 'EarthCover', 'JPL', 'Jet Propulsion Laboratory', 'Landsat', 'WMS', 'SLD', 'Global']
29
30    >>> p = wms.capabilities.provider
31    >>> p.name
32    'Lucian Plesea'
33    >>> p.email
34    'lucian.plesea@jpl.nasa.gov'
35
36   
37Test available content layers
38
39    >>> [layer.name for layer in wms.capabilities.contents]
40    ['global_mosaic', 'global_mosaic_base', 'us_landsat_wgs84', 'srtm_mag', 'daily_terra_721', 'daily_aqua_721', 'daily_terra_ndvi', 'daily_aqua_ndvi', 'daily_terra', 'daily_aqua', 'BMNG', 'modis', 'huemapped_srtm', 'srtmplus', 'worldwind_dem', 'us_ned', 'us_elevation', 'us_colordem']
41   
42    >>> [layer.title for layer in wms.capabilities.contents]
43    ['WMS Global Mosaic, pan sharpened', 'WMS Global Mosaic, not pan sharpened', 'CONUS mosaic of 1990 MRLC dataset', 'SRTM reflectance magnitude, 30m', 'Daily composite of MODIS-TERRA 721 pseudocolor', 'Daily composite of MODIS-AQUA 721 pseudocolor', 'Daily composite of MODIS-TERRA images, NDVI processing', 'Daily composite of MODIS-AQUA images, NDVI processing', 'Daily composite of MODIS-TERRA images', 'Daily composite of MODIS-AQUA images', 'Blue Marble Next Generation, Global MODIS derived image', 'Blue Marble, Global MODIS derived image', 'SRTM derived global elevation, 3 arc-second, hue mapped', 'Global 1km elevation, seamless SRTM land elevation and ocean depth', 'SRTM derived global elevation, 3 arc-second', 'United States elevation, 30m', 'Digital Elevation Map of the United States, DTED dataset, 3 second resolution, grayscale', 'Digital Elevation Map of the United States, DTED dataset, 3 second resolution, hue mapped']
44   
45Test single item accessor
46
47    >>> wms.capabilities.getContentByName('global_mosaic').title
48    'WMS Global Mosaic, pan sharpened'
49   
50    >>> wms.capabilities.getContentByName('global_mosaic').boundingBox
51
52    >>> wms.capabilities.getContentByName('global_mosaic').boundingBoxWGS84
53    (-180.0, -60.0, 180.0, 84.0)
54   
55    >>> wms.capabilities.getContentByName('global_mosaic').crsOptions
56    ['EPSG:4326', 'AUTO:42003']
57   
58    >>> wms.capabilities.getContentByName('global_mosaic').styles
59    {'pseudo_bright': {'title': 'Pseudo-color image (Uses IR and Visual bands, 542 mapping), gamma 1.5'}, 'pseudo': {'title': '(default) Pseudo-color image, pan sharpened (Uses IR and Visual bands, 542 mapping), gamma 1.5'}, 'visual': {'title': 'Real-color image, pan sharpened (Uses the visual bands, 321 mapping), gamma 1.5'}, 'pseudo_low': {'title': 'Pseudo-color image, pan sharpened (Uses IR and Visual bands, 542 mapping)'}, 'visual_low': {'title': 'Real-color image, pan sharpened (Uses the visual bands, 321 mapping)'}, 'visual_bright': {'title': 'Real-color image (Uses the visual bands, 321 mapping), gamma 1.5'}}
60   
61Expect a KeyError for invalid names
62
63    >>> wms.capabilities.getContentByName('utterly bogus').title
64    Traceback (most recent call last):
65    ...
66    KeyError: 'No content named utterly bogus'
67
68Test operations
69
70    >>> [op.name for op in wms.capabilities.operations]
71    ['GetCapabilities', 'GetMap']
72   
73    >>> wms.capabilities.getOperationByName('GetMap').methods
74    {'Get': {'url': 'http://wms.jpl.nasa.gov/wms.cgi?'}}
75   
76    >>> wms.capabilities.getOperationByName('GetMap').formatOptions
77    ['image/jpeg', 'image/png', 'image/geotiff', 'image/tiff']
78
79Test exceptions
80
81    >>> wms.capabilities.exceptions
82    ['application/vnd.ogc.se_xml']
83
84Lastly, test the getcapabilities method
85
86    >>> wms = WebMapService('http://wms.jpl.nasa.gov/wms.cgi', version='1.1.1')
87    >>> xml = wms.getcapabilities().read()
88    >>> xml.find('<WMT_MS_Capabilities version="1.1.1">') > 0
89    True
90
Note: See TracBrowser for help on using the repository browser.