diff --git a/docs/source/_static/iem_goes_ir.png b/docs/source/_static/iem_goes_ir.png new file mode 100644 index 000000000..b4eb43443 Binary files /dev/null and b/docs/source/_static/iem_goes_ir.png differ diff --git a/docs/source/_static/jpl_mosaic_visb.jpg b/docs/source/_static/jpl_mosaic_visb.jpg deleted file mode 100644 index a528746a3..000000000 Binary files a/docs/source/_static/jpl_mosaic_visb.jpg and /dev/null differ diff --git a/docs/source/usage.rst b/docs/source/usage.rst index e85c1f8f4..83a168e35 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -9,71 +9,66 @@ Find out what a WMS has to offer. Service metadata: .. code-block:: python >>> from owslib.wms import WebMapService - >>> wms = WebMapService('http://wms.jpl.nasa.gov/wms.cgi', version='1.1.1') + >>> wms = WebMapService('https://mesonet.agron.iastate.edu/cgi-bin/mapserv/mapserv?map=/opt/iem/data/wms/goes/west_ir.map&SERVICE=WMS&REQUEST=GetCapabilities') >>> wms.identification.type 'OGC:WMS' >>> wms.identification.version '1.1.1' >>> wms.identification.title - 'JPL Global Imagery Service' + 'IEM GOES IR WMS Service' >>> wms.identification.abstract - 'WMS Server maintained by JPL, worldwide satellite imagery.' + 'IEM generated CONUS composite of GOES IR Satellite.' Available layers: .. code-block:: python >>> list(wms.contents) - ['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'] + ['goes_west_ir', 'west_ir_4km', 'west_ir_4km_gray'] Details of a layer: .. code-block:: python - >>> wms['global_mosaic'].title - 'WMS Global Mosaic, pan sharpened' - >>> wms['global_mosaic'].queryable + >>> wms['goes_west_ir'].title + 'IEM GOES IR WMS Service' + >>> wms['goes_west_ir'].queryable 0 - >>> wms['global_mosaic'].opaque + >>> wms['goes_west_ir'].opaque 0 - >>> wms['global_mosaic'].boundingBox - >>> wms['global_mosaic'].boundingBoxWGS84 - (-180.0, -60.0, 180.0, 84.0) - >>> wms['global_mosaic'].crsOptions - ['EPSG:4326', 'AUTO:42003'] - >>> wms['global_mosaic'].styles - {'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'}} + >>> wms['goes_west_ir'].boundingBox + (-126.0, 24.0, -66.0, 50.0, 'EPSG:4326') + >>> wms['goes_west_ir'].boundingBoxWGS84 + (-126.0, 24.0, -66.0, 50.0) + >>> wms['goes_west_ir'].crsOptions + ['EPSG:3857', 'EPSG:4326'] Available methods, their URLs, and available formats: .. code-block:: python >>> [op.name for op in wms.operations] - ['GetCapabilities', 'GetMap'] + ['GetCapabilities', 'GetMap', 'GetFeatureInfo', 'DescribeLayer', 'GetLegendGraphic', 'GetStyles'] >>> wms.getOperationByName('GetMap').methods - {'Get': {'url': 'http://wms.jpl.nasa.gov/wms.cgi?'}} + [{'type': 'Get', 'url': 'https://mesonet.agron.iastate.edu/cgi-bin/mapserv/mapserv?map=/opt/iem/data/wms/goes/west_ir.map&SERVICE=WMS&'}, {'type': 'Post', 'url': 'https://mesonet.agron.iastate.edu/cgi-bin/mapserv/mapserv?map=/opt/iem/data/wms/goes/west_ir.map&SERVICE=WMS&'}] >>> wms.getOperationByName('GetMap').formatOptions - ['image/jpeg', 'image/png', 'image/geotiff', 'image/tiff'] + ['image/png', 'image/jpeg', 'image/png; mode=8bit', 'image/vnd.jpeg-png', 'image/vnd.jpeg-png8', 'application/x-pdf', 'image/svg+xml', 'image/tiff', 'application/json'] That's everything needed to make a request for imagery: .. code-block:: python - >>> img = wms.getmap( layers=['global_mosaic'], - ... styles=['visual_bright'], - ... srs='EPSG:4326', - ... bbox=(-112, 36, -106, 41), - ... size=(300, 250), - ... format='image/jpeg', - ... transparent=True - ... ) - >>> out = open('jpl_mosaic_visb.jpg', 'wb') - >>> out.write(img.read()) - >>> out.close() + >>> img = wms.getmap(layers=['goes_west_ir'], + size=(300, 250), + bbox=(-126, 24, -66, 50), + srs='EPSG:4326', + format='image/png') + >>> with open('iem_goes_ir.png', 'wb') as fh: + ... fh.write(img.read()) Result: -.. image:: _static/jpl_mosaic_visb.jpg +.. image:: _static/iem_goes_ir.png :width: 300px :height: 250px :alt: WMS GetMap generated by OWSLib