OWSLib


NameOWSLib JSON
Version 0.30.0 PyPI version JSON
download
home_pagehttps://owslib.readthedocs.io
SummaryOGC Web Service utility library
upload_time2024-03-10 22:00:10
maintainerTom Kralidis
docs_urlNone
authorSean Gillies
requires_python>=3.6
licenseBSD
keywords gis ogc ogcapi ows opensearch iso 19115 fgdc dif ows wfs wms sos csw wps wcs capabilities metadata wmts
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OWSLib

[![Build](https://github.com/geopython/OWSLib/workflows/main.yml/badge.svg)](https://github.com/geopython/OWSLib/actions)
[![License](https://img.shields.io/github/license/geopython/OWSLib.svg)](https://github.com/geopython/OWSLib/blob/master/LICENSE)
[![Chat](https://badges.gitter.im/geopython/OWSLib.svg)](https://app.gitter.im/#/room/#geopython_owslib:gitter.im)

## Overview

OWSLib is a Python package for client programming with Open Geospatial
Consortium (OGC) web service (hence OWS) interface standards, and their
related content models.

Full documentation is available at https://owslib.readthedocs.io

OWSLib provides a common API for accessing service metadata and wrappers for
numerous OGC Web Service interfaces.

## Installation

The easiest way to install pywis-pubsub is via the Python [pip](https://pip.pypa.io)
utility:

```bash
pip3 install OWSLib
```

## Requirements

- Python 3
- [virtualenv](https://virtualenv.pypa.io)

### Dependencies

Dependencies are listed in [requirements.txt](requirements.txt). Dependencies
are automatically installed during OWSLib installation.

### Installing OWSLib

```bash
# setup virtualenv
python3 -m venv owslib
cd owslib
source bin/activate

# clone codebase and install
git clone https://github.com/geopython/OWSLib.git
cd OWSLib
python3 setup.py install
```

## Running

Find out what a WMS has to offer. Service metadata:

```python

>>> from owslib.wms import WebMapService
>>> wms = WebMapService('http://wms.jpl.nasa.gov/wms.cgi', version='1.1.1')
>>> wms.identification.type
'OGC:WMS'
>>> wms.identification.version
'1.1.1'
>>> wms.identification.title
'JPL Global Imagery Service'
>>> wms.identification.abstract
'WMS Server maintained by JPL, worldwide satellite imagery.'

Available layers::

    >>> list(wms.contents)
    ['us_landsat_wgs84', 'modis', 'global_mosaic_base', 'huemapped_srtm',
    'srtm_mag', 'daily_terra', 'us_ned', 'us_elevation', 'global_mosaic',
    'daily_terra_ndvi', 'daily_aqua_ndvi', 'daily_aqua_721', 'daily_planet',
    'BMNG', 'srtmplus', 'us_colordem', None, 'daily_aqua', 'worldwind_dem',
    'daily_terra_721']

Details of a layer::

    >>> wms['global_mosaic'].title
    'WMS Global Mosaic, pan sharpened'
    >>> 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'}}

Available methods, their URLs, and available formats::

    >>> [op.name for op in wms.operations]
    ['GetTileService', 'GetCapabilities', 'GetMap']
    >>> wms.getOperationByName('GetMap').methods
    {'Get': {'url': 'http://wms.jpl.nasa.gov/wms.cgi?'}}
    >>> wms.getOperationByName('GetMap').formatOptions
    ['image/jpeg', 'image/png', 'image/geotiff', 'image/tiff']

That's everything needed to make a request for imagery::

    >>> 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()
```

A very similar API exists for WebFeatureService. See
tests/wfs_MapServerWFSCapabilities.txt for details.

There is also support for Web Coverage Service (WCS), Catalogue
Service for the Web (CSW), Web Processing Service (WPS), and Web
Map Tile Service (WMTS). Some of those are beta quality.


Logging
-------
OWSLib logs messages to the 'owslib' named python logger. You may
configure your application to use the log messages like so:

```python
    >>> import logging
    >>> owslib_log = logging.getLogger('owslib')
    >>> # Add formatting and handlers as needed, for example to log to the console
    >>> ch = logging.StreamHandler()
    >>> ch.setLevel(logging.DEBUG)
    >>> ch.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
    >>> # add the handler to the logger
    >>> owslib_log.addHandler(ch)
    >>> owslib_log.setLevel(logging.DEBUG)
```

Releasing
---------

```bash
  # update version
  vi owslib/__init__.py
  git commit -m 'update release version' owslib/__init__.py
  # push changes
  git push origin master
  git tag -a x.y.z -m 'tagging OWSLib release x.y.z'
  # push tag
  git push --tags
  # update on PyPI (must be a maintainer)
  rm -fr build dist *.egg-info
  python setup.py sdist bdist_wheel --universal
  twine upload dist/*
```

Support
-------

- https://lists.osgeo.org/mailman/listinfo/owslib-users
- https://lists.osgeo.org/mailman/listinfo/owslib-devel

            

Raw data

            {
    "_id": null,
    "home_page": "https://owslib.readthedocs.io",
    "name": "OWSLib",
    "maintainer": "Tom Kralidis",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "tomkralidis@gmail.com",
    "keywords": "gis ogc ogcapi ows opensearch iso 19115 fgdc dif ows wfs wms sos csw wps wcs capabilities metadata wmts",
    "author": "Sean Gillies",
    "author_email": "sean.gillies@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/12/e7/50b7f966e0a709db2afe3eb466b0da8a63be2f2a3c6630c8c3bf76a7486b/OWSLib-0.30.0.tar.gz",
    "platform": null,
    "description": "# OWSLib\n\n[![Build](https://github.com/geopython/OWSLib/workflows/main.yml/badge.svg)](https://github.com/geopython/OWSLib/actions)\n[![License](https://img.shields.io/github/license/geopython/OWSLib.svg)](https://github.com/geopython/OWSLib/blob/master/LICENSE)\n[![Chat](https://badges.gitter.im/geopython/OWSLib.svg)](https://app.gitter.im/#/room/#geopython_owslib:gitter.im)\n\n## Overview\n\nOWSLib is a Python package for client programming with Open Geospatial\nConsortium (OGC) web service (hence OWS) interface standards, and their\nrelated content models.\n\nFull documentation is available at https://owslib.readthedocs.io\n\nOWSLib provides a common API for accessing service metadata and wrappers for\nnumerous OGC Web Service interfaces.\n\n## Installation\n\nThe easiest way to install pywis-pubsub is via the Python [pip](https://pip.pypa.io)\nutility:\n\n```bash\npip3 install OWSLib\n```\n\n## Requirements\n\n- Python 3\n- [virtualenv](https://virtualenv.pypa.io)\n\n### Dependencies\n\nDependencies are listed in [requirements.txt](requirements.txt). Dependencies\nare automatically installed during OWSLib installation.\n\n### Installing OWSLib\n\n```bash\n# setup virtualenv\npython3 -m venv owslib\ncd owslib\nsource bin/activate\n\n# clone codebase and install\ngit clone https://github.com/geopython/OWSLib.git\ncd OWSLib\npython3 setup.py install\n```\n\n## Running\n\nFind out what a WMS has to offer. Service metadata:\n\n```python\n\n>>> from owslib.wms import WebMapService\n>>> wms = WebMapService('http://wms.jpl.nasa.gov/wms.cgi', version='1.1.1')\n>>> wms.identification.type\n'OGC:WMS'\n>>> wms.identification.version\n'1.1.1'\n>>> wms.identification.title\n'JPL Global Imagery Service'\n>>> wms.identification.abstract\n'WMS Server maintained by JPL, worldwide satellite imagery.'\n\nAvailable layers::\n\n    >>> list(wms.contents)\n    ['us_landsat_wgs84', 'modis', 'global_mosaic_base', 'huemapped_srtm',\n    'srtm_mag', 'daily_terra', 'us_ned', 'us_elevation', 'global_mosaic',\n    'daily_terra_ndvi', 'daily_aqua_ndvi', 'daily_aqua_721', 'daily_planet',\n    'BMNG', 'srtmplus', 'us_colordem', None, 'daily_aqua', 'worldwind_dem',\n    'daily_terra_721']\n\nDetails of a layer::\n\n    >>> wms['global_mosaic'].title\n    'WMS Global Mosaic, pan sharpened'\n    >>> wms['global_mosaic'].boundingBoxWGS84\n    (-180.0, -60.0, 180.0, 84.0)\n    >>> wms['global_mosaic'].crsOptions\n    ['EPSG:4326', 'AUTO:42003']\n    >>> wms['global_mosaic'].styles\n    {'pseudo_bright': {'title': 'Pseudo-color image (Uses IR and Visual bands,\n    542 mapping), gamma 1.5'}, 'pseudo': {'title': '(default) Pseudo-color\n    image, pan sharpened (Uses IR and Visual bands, 542 mapping), gamma 1.5'},\n    'visual': {'title': 'Real-color image, pan sharpened (Uses the visual\n    bands, 321 mapping), gamma 1.5'}, 'pseudo_low': {'title': 'Pseudo-color\n    image, pan sharpened (Uses IR and Visual bands, 542 mapping)'},\n    'visual_low': {'title': 'Real-color image, pan sharpened (Uses the visual\n    bands, 321 mapping)'}, 'visual_bright': {'title': 'Real-color image (Uses\n    the visual bands, 321 mapping), gamma 1.5'}}\n\nAvailable methods, their URLs, and available formats::\n\n    >>> [op.name for op in wms.operations]\n    ['GetTileService', 'GetCapabilities', 'GetMap']\n    >>> wms.getOperationByName('GetMap').methods\n    {'Get': {'url': 'http://wms.jpl.nasa.gov/wms.cgi?'}}\n    >>> wms.getOperationByName('GetMap').formatOptions\n    ['image/jpeg', 'image/png', 'image/geotiff', 'image/tiff']\n\nThat's everything needed to make a request for imagery::\n\n    >>> img = wms.getmap(   layers=['global_mosaic'],\n    ...                     styles=['visual_bright'],\n    ...                     srs='EPSG:4326',\n    ...                     bbox=(-112, 36, -106, 41),\n    ...                     size=(300, 250),\n    ...                     format='image/jpeg',\n    ...                     transparent=True\n    ...                     )\n    >>> out = open('jpl_mosaic_visb.jpg', 'wb')\n    >>> out.write(img.read())\n    >>> out.close()\n```\n\nA very similar API exists for WebFeatureService. See\ntests/wfs_MapServerWFSCapabilities.txt for details.\n\nThere is also support for Web Coverage Service (WCS), Catalogue\nService for the Web (CSW), Web Processing Service (WPS), and Web\nMap Tile Service (WMTS). Some of those are beta quality.\n\n\nLogging\n-------\nOWSLib logs messages to the 'owslib' named python logger. You may\nconfigure your application to use the log messages like so:\n\n```python\n    >>> import logging\n    >>> owslib_log = logging.getLogger('owslib')\n    >>> # Add formatting and handlers as needed, for example to log to the console\n    >>> ch = logging.StreamHandler()\n    >>> ch.setLevel(logging.DEBUG)\n    >>> ch.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))\n    >>> # add the handler to the logger\n    >>> owslib_log.addHandler(ch)\n    >>> owslib_log.setLevel(logging.DEBUG)\n```\n\nReleasing\n---------\n\n```bash\n  # update version\n  vi owslib/__init__.py\n  git commit -m 'update release version' owslib/__init__.py\n  # push changes\n  git push origin master\n  git tag -a x.y.z -m 'tagging OWSLib release x.y.z'\n  # push tag\n  git push --tags\n  # update on PyPI (must be a maintainer)\n  rm -fr build dist *.egg-info\n  python setup.py sdist bdist_wheel --universal\n  twine upload dist/*\n```\n\nSupport\n-------\n\n- https://lists.osgeo.org/mailman/listinfo/owslib-users\n- https://lists.osgeo.org/mailman/listinfo/owslib-devel\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "OGC Web Service utility library",
    "version": "0.30.0",
    "project_urls": {
        "Homepage": "https://owslib.readthedocs.io"
    },
    "split_keywords": [
        "gis",
        "ogc",
        "ogcapi",
        "ows",
        "opensearch",
        "iso",
        "19115",
        "fgdc",
        "dif",
        "ows",
        "wfs",
        "wms",
        "sos",
        "csw",
        "wps",
        "wcs",
        "capabilities",
        "metadata",
        "wmts"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "82e58e2606352a44571d9e351159a2d35045705a140908c3f3f78949c6b14320",
                "md5": "aa71883e1707930dd24b9879124a82f2",
                "sha256": "88277cf674ded604596af5c04eb2a17c6846dfe8bcfb7a5dc9ab50b3ef5f1385"
            },
            "downloads": -1,
            "filename": "OWSLib-0.30.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "aa71883e1707930dd24b9879124a82f2",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 222761,
            "upload_time": "2024-03-10T22:00:08",
            "upload_time_iso_8601": "2024-03-10T22:00:08.108222Z",
            "url": "https://files.pythonhosted.org/packages/82/e5/8e2606352a44571d9e351159a2d35045705a140908c3f3f78949c6b14320/OWSLib-0.30.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "12e750b7f966e0a709db2afe3eb466b0da8a63be2f2a3c6630c8c3bf76a7486b",
                "md5": "4d9b4de2bb6e180fcc4f8daa1d772c0e",
                "sha256": "f17413cc75836c0303cd1d4fd9bb0f21915a8b492dacc64ef5f4021b28e82d4c"
            },
            "downloads": -1,
            "filename": "OWSLib-0.30.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4d9b4de2bb6e180fcc4f8daa1d772c0e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 175405,
            "upload_time": "2024-03-10T22:00:10",
            "upload_time_iso_8601": "2024-03-10T22:00:10.886318Z",
            "url": "https://files.pythonhosted.org/packages/12/e7/50b7f966e0a709db2afe3eb466b0da8a63be2f2a3c6630c8c3bf76a7486b/OWSLib-0.30.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-10 22:00:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "owslib"
}
        
Elapsed time: 0.19824s