Changeset 529

Show
Ignore:
Timestamp:
10/19/06 09:17:26
Author:
seang
Message:

complete discovery-to-imagery WMS example

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OWSLib/trunk/README.txt

    r524 r529  
    22OWSLib 
    33====== 
     4Package for working with OGC web map and feature services. 
    45 
    5 An etree-based module for working with OGC W*S web services. This package 
    6 provides a common API for WMS and WFS service metadata, and wrappers for 
     6OWSLib provides a common API for accessing service metadata and wrappers for 
    77GetCapabilities, GetMap, and GetFeature requests. 
    88 
     
    1717------------ 
    1818 
    19   $ python setup.py install 
     19$ python setup.py install 
    2020 
    2121 
     
    2323----- 
    2424 
    25 See tests/*.txt, which are doctests. 
     25Find out what a WMS has to offer. Service metadata: 
     26 
     27    >>> from owslib.wms import WebMapService 
     28    >>> wms = WebMapService('http://wms.jpl.nasa.gov/wms.cgi', version='1.1.1') 
     29    >>> wms.capabilities.service 
     30    'OGC:WMS' 
     31    >>> wms.capabilities.title 
     32    'JPL Global Imagery Service' 
     33 
     34Available layers: 
     35 
     36    >>> [layer.name for layer in wms.capabilities.contents] 
     37    ['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'] 
     38 
     39Details of a layer: 
     40 
     41    >>> wms.capabilities.getContentByName('global_mosaic').title 
     42    'WMS Global Mosaic, pan sharpened' 
     43    >>> wms.capabilities.getContentByName('global_mosaic').boundingBox 
     44    >>> wms.capabilities.getContentByName('global_mosaic').boundingBoxWGS84 
     45    (-180.0, -60.0, 180.0, 84.0) 
     46    >>> wms.capabilities.getContentByName('global_mosaic').crsOptions 
     47    ['EPSG:4326', 'AUTO:42003'] 
     48    >>> wms.capabilities.getContentByName('global_mosaic').styles 
     49    {'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'}} 
     50 
     51Available methods, their URLs, and available formats: 
     52 
     53    >>> [op.name for op in wms.capabilities.operations] 
     54    ['GetCapabilities', 'GetMap'] 
     55    >>> wms.capabilities.getOperationByName('GetMap').methods 
     56    {'Get': {'url': 'http://wms.jpl.nasa.gov/wms.cgi?'}} 
     57    >>> wms.capabilities.getOperationByName('GetMap').formatOptions 
     58    ['image/jpeg', 'image/png', 'image/geotiff', 'image/tiff'] 
     59 
     60That's everything needed to make a request for imagery: 
     61 
     62    >>> img = wms.getmap(   layers=['global_mosaic'], 
     63    ...                     styles=['visual_bright'], 
     64    ...                     srs='EPSG:4326', 
     65    ...                     bbox=(-112, 36, -106, 41), 
     66    ...                     size=(300, 250), 
     67    ...                     format='image/jpeg', 
     68    ...                     transparent=True 
     69    ...                     ) 
     70    >>> out = open('jpl_mosaic_visb.jpg', 'wb') 
     71    >>> out.write(img.read()) 
     72    >>> out.close() 
     73 
     74A very similar API exists for WebFeatureService. See 
     75tests/MapServerWFSCapabilities.txt for details. 
    2676 
    2777 
     
    2979------------ 
    3080 
    31 OWSLib works with WMS version 1.1 and WFS 1.0. Other versions are not supported 
    32 at this time. 
     81OWSLib works with WMS version 1.1.1 and WFS 1.0.0 Other versions are not 
     82supported at this time. 
    3383 
     84 
     85Support 
     86------- 
     87 
     88OWSLib shares a wiki and email list with the Python Cartographic Library: 
     89 
     90http://lists.gispython.org/mailman/listinfo/community 
     91http://trac.gispython.org/projects/PCL/wiki 
     92 
     93Updated project information can be found at 
     94 
     95http://trac.gispython.org/projects/PCL/wiki/OwsLib 
     96 
     97