Skip to content

Commit 8dab0d0

Browse files
committed
Add OWSLib overview and quickstart
1 parent bf7c85f commit 8dab0d0

File tree

6 files changed

+284
-0
lines changed

6 files changed

+284
-0
lines changed

doc/images/projects/owslib/itasca.png

317 KB
Loading
25 KB
Loading
57.2 KB
Loading

doc/overview/owslib_overview.rst

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
:Author: OSGeoLive
2+
:Author: Seth Girvin
3+
:Version: osgeolive17.0
4+
:License: Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
5+
6+
@LOGO_owslib@
7+
@OSGEO_KIND_owslib@
8+
9+
10+
@NAME_owslib@
11+
================================================================================
12+
13+
Open Geospatial Web Services Library
14+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15+
16+
OWSLib is a `Python`_ package for client programming with `Open Geospatial Consortium`_ (OGC) web service (hence OWS) interface standards,
17+
and their related content models.
18+
19+
OWSLib is Open Source, released under an BSD 3-Clause License, and runs on any platform that supports Python (Windows, Linux, Mac OS X).
20+
21+
@SCREENSHOT_owslib@
22+
23+
Core Features
24+
--------------------------------------------------------------------------------
25+
26+
* easily connect to WMS, WFS, WCS, WPS, CSW services using Python (and many more)
27+
* support for the new OGC APIs
28+
* easy to install with ``pip install OWSLib``
29+
* also available with Conda, and as a Debian package
30+
* an `OSGeo Community Project`_
31+
* detailed log output
32+
* support for proxies
33+
34+
Implemented Standards
35+
--------------------------------------------------------------------------------
36+
37+
OGC Standards
38+
+++++++++++++
39+
40+
+-----------------------+----------------+-----------------------+----------------+
41+
| **Standard** | **Version(s)** | **Standard** | **Version(s)** |
42+
+=======================+================+=======================+================+
43+
| `OGC WMS`_ | 1.1.1, 1.3.0 | `OGC WFS`_ | 1.0.0, 1.1.0, |
44+
| | | | 2.0.0, 3.0 |
45+
+-----------------------+----------------+-----------------------+----------------+
46+
| `OGC WCS`_ | 1.0.0, 1.1.0, | `OGC WMC`_ | 1.1.0 |
47+
| | 2.0, 2.0.1 | | |
48+
+-----------------------+----------------+-----------------------+----------------+
49+
| `OGC SOS`_ | 1.0.0, 2.0.0 | `OGC SensorML`_ | 1.0.1 |
50+
+-----------------------+----------------+-----------------------+----------------+
51+
| `OGC CSW`_ | 2.0.2 | `OGC WPS`_ | 1.0.0 |
52+
+-----------------------+----------------+-----------------------+----------------+
53+
| `OGC Filter`_ | 1.1.0 | `OGC OWS Common`_ | 1.0.0, 1.1.0, |
54+
| | | | 2.0 |
55+
+-----------------------+----------------+-----------------------+----------------+
56+
| `OGC OWS Context`_ | 1.0.0 (alpha) | `NASA DIF`_ | 9.7 |
57+
+-----------------------+----------------+-----------------------+----------------+
58+
| `FGDC CSDGM`_ | 1998 | `ISO 19139`_ | 2007 |
59+
+-----------------------+----------------+-----------------------+----------------+
60+
| `ISO 19139-2`_ | 2012 | `Dublin Core`_ | 1.1 |
61+
+-----------------------+----------------+-----------------------+----------------+
62+
| `Swiss GM03`_ | 2.3 | `OGC WMTS`_ | 1.0.0 |
63+
+-----------------------+----------------+-----------------------+----------------+
64+
| `WaterML`_ | 1.0, 1.1, 2.0 | `OpenSearch`_ | 1.1 |
65+
+-----------------------+----------------+-----------------------+----------------+
66+
67+
OGC API Support
68+
+++++++++++++++
69+
70+
+--------------------------------------------------------+-------------+--------------------------------------------------------+-------------+
71+
| **Standard** | **Version** | **Standard** | **Version** |
72+
+========================================================+=============+========================================================+=============+
73+
| `OGC API - Features - Part 1: Core`_ | 1.0 | `OGC API - Coverages - Part 1: Core`_ | draft |
74+
+--------------------------------------------------------+-------------+--------------------------------------------------------+-------------+
75+
| `OGC API - Records - Part 1: Core`_ | draft | `OGC API - Features - Part 3: Filtering and CQL`_ | draft |
76+
+--------------------------------------------------------+-------------+--------------------------------------------------------+-------------+
77+
| `OGC API - Features - Part 4: CRUD`_ | draft | `OGC API - Processes - Part 1: Core`_ | 1.0 |
78+
+--------------------------------------------------------+-------------+--------------------------------------------------------+-------------+
79+
| `OGC API - Connected Systems - Part 1: Feature Res.`_ | draft | `OGC API - Connected Systems - Part 2: Dynamic Data`_ | draft |
80+
+--------------------------------------------------------+-------------+--------------------------------------------------------+-------------+
81+
82+
Details
83+
--------------------------------------------------------------------------------
84+
85+
**Website:** @WEB_owslib@
86+
87+
**Licence:** `BSD 3-Clause License`_
88+
89+
**Software Version:** |version-owslib|
90+
91+
**Supported Platforms:** Windows, Linux, Mac
92+
93+
**API Interfaces:** Python
94+
95+
**Support:** |SUPPORT|
96+
97+
.. _`Open Geospatial Consortium`: https://ogc.org
98+
.. _`Python`: https://www.python.org/
99+
.. _`OSGeo Community Project`: https://www.osgeo.org/projects/owslib/
100+
.. _`BSD 3-Clause License`: https://owslib.readthedocs.io/en/stable/license.html
101+
102+
.. _`OGC WMS`: https://www.opengeospatial.org/standards/wms
103+
.. _`OGC WFS`: https://www.opengeospatial.org/standards/wfs
104+
.. _`OGC WCS`: https://www.opengeospatial.org/standards/wcs
105+
.. _`OGC WMC`: https://www.opengeospatial.org/standards/wmc
106+
.. _`OGC WPS`: https://www.opengeospatial.org/standards/wps
107+
.. _`OGC SOS`: https://www.opengeospatial.org/standards/sos
108+
.. _`OGC O&M`: https://www.opengeospatial.org/standards/om
109+
.. _`OGC WaterML2.0`: https://www.opengeospatial.org/standards/waterml
110+
.. _`OGC SensorML`: https://www.opengeospatial.org/standards/sensorml
111+
.. _`OGC CSW`: https://www.opengeospatial.org/standards/cat
112+
.. _`OGC WMTS`: https://www.opengeospatial.org/standards/wmts
113+
.. _`OGC Filter`: https://www.opengeospatial.org/standards/filter
114+
.. _`OGC OWS Common`: https://www.opengeospatial.org/standards/common
115+
.. _`OGC OWS Context`: https://www.opengeospatial.org/standards/owc
116+
.. _`NASA DIF`: https://earthdata.nasa.gov/esdis/eso/standards-and-references/directory-interchange-format-dif-standard
117+
.. _`FGDC CSDGM`: https://www.fgdc.gov/metadata/csdgm-standard
118+
.. _`ISO 19115`: https://www.iso.org/standard/26020.html
119+
.. _`ISO 19139`: https://www.iso.org/standard/32557.html
120+
.. _`ISO 19139-2`: https://www.iso.org/standard/57104.html
121+
.. _`Dublin Core`: https://www.dublincore.org/
122+
.. _`CIA.vc`: http://cia.vc/stats/project/OWSLib
123+
.. _`WaterML`: http://his.cuahsi.org/wofws.html#waterml
124+
.. _`Swiss GM03`: https://www.geocat.admin.ch/en/dokumentation/gm03.html
125+
.. _`OGC API`: https://ogcapi.ogc.org
126+
.. _`OGC API - Features - Part 1: Core`: https://docs.opengeospatial.org/is/17-069r3/17-069r3.html
127+
.. _`OGC API - Records - Part 1: Core`: https://github.com/opengeospatial/ogcapi-records
128+
.. _`OGC API - Features - Part 3: Filtering and CQL`: https://docs.ogc.org/DRAFTS/19-079.html
129+
.. _`OGC API - Features - Part 4: CRUD`: https://docs.ogc.org/DRAFTS/20-002.html
130+
.. _`OGC API - Coverages - Part 1: Core`: https://docs.ogc.org/DRAFTS/19-087.html
131+
.. _`OGC API - Processes - Part 1: Core`: https://docs.ogc.org/is/18-062r2/18-062r2.html
132+
.. _`OGC API - Connected Systems - Part 1: Feature Res.`: https://docs.ogc.org/DRAFTS/23-001r0.html
133+
.. _`OGC API - Connected Systems - Part 2: Dynamic Data`: https://docs.ogc.org/DRAFTS/23-002r0.html
134+
.. _`OpenSearch`: https://github.com/dewitt/opensearch
135+
136+
137+
@VMDK_owslib@
138+
@QUICKSTART_owslib@
139+
140+
.. presentation-note
141+
OWSLib is a Python package for client programming with Open Geospatial Consortium (OGC) web service
142+
interface standards, and their related content models.

doc/quickstart/owslib_quickstart.rst

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
:Author: OSGeoLive
2+
:Author: Seth Girvin
3+
:Version: osgeolive17.0
4+
:License: Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
5+
6+
@LOGO_owslib@
7+
@OSGEO_KIND_owslib@
8+
@VMDK_owslib@
9+
10+
11+
12+
********************************************************************************
13+
@NAME_owslib@ Quickstart
14+
********************************************************************************
15+
16+
OWSLib is a Python package for client programming with Open Geospatial Consortium (OGC) web service
17+
interface standards, and their related content models.
18+
19+
Included with OSGeoLive, OWSLib offers ready-to-use access to OGC services exposed by
20+
other bundled geospatial applications.
21+
22+
.. contents:: Contents
23+
:local:
24+
25+
Download a WMS Image from MapServer
26+
--------------------------------------------------------------------------------
27+
28+
An example of connecting to the MapServer demo on OSGeoLive and downloading a WMS image.
29+
30+
.. code-block:: bash
31+
32+
$ python3
33+
>>> from owslib.wms import WebMapService
34+
>>> url = "http://localhost/cgi-bin/mapserv?map=/usr/local/www/docs_maps/mapserver_demos/itasca/itasca.map"
35+
>>> wms = WebMapService(url, version='1.3.0')
36+
>>> wms.identification.title
37+
print(wms.identification.title)
38+
>>> list(wms.contents)
39+
['ITASCA', 'drgs',...
40+
>>> wms['mcd90py2'].title
41+
'Minor Civil Divisions'
42+
>>> wms['mcd90py2'].boundingBox
43+
(393234.0, 5207990.0, 495770.0, 5305370.0, 'EPSG:26915')
44+
>>> wms['mcd90py2'].crsOptions
45+
['EPSG:26915', 'EPSG:3857']
46+
>>> img = wms.getmap(layers=['ITASCA'], srs='EPSG:26915', bbox=(393234.0, 5207990.0, 495770.0, 5305370.0),
47+
size=(800, 800), format='image/png', transparent=True)
48+
>>> out = open('itasca.png', 'wb')
49+
>>> out.write(img.read())
50+
>>> out.close()
51+
52+
.. image:: /images/projects/owslib/itasca.png
53+
:scale: 70 %
54+
:alt: Output image from MapServer WMS
55+
56+
Inspect pyWPS Processes
57+
--------------------------------------------------------------------------------
58+
59+
An example of connecting to the PyWPS demo server on OSGeoLive and inspecting the available processes.
60+
61+
.. code-block:: bash
62+
63+
$ python3
64+
>>> from owslib.wps import WebProcessingService
65+
>>> wps = WebProcessingService('http://localhost/pywps/wps.py?')
66+
>>> print(wps.identification)
67+
Service: WPS, title=PyWPS Processing Service
68+
>>> for process in wps.processes: print(f"Identifier: {process.identifier}: Title: {process.title}")
69+
Identifier: say_hello: Title: Process Say Hello
70+
>>> inputs = [("name", "OWSLib")]
71+
>>> execution = wps.execute(say_hello_process.identifier, inputs)
72+
>>> output_data = execution.processOutputs[0].data
73+
>>> print(f"Output data: {output_data}")
74+
Output data: ['Hello OWSLib']
75+
76+
Using CSW with pycsw
77+
--------------------------------------------------------------------------------
78+
79+
An example of connecting to the Catalogue Service for the Web (CSW) demo server provided by pycsw on OSGeoLive.
80+
81+
.. code-block:: bash
82+
83+
$ python3
84+
>>> from owslib.csw import CatalogueServiceWeb
85+
>>> csw = CatalogueServiceWeb('http://localhost/pycsw/')
86+
>>> print(f"Title {csw.identification.title} Type: {csw.identification.type}")
87+
Title: pycsw Geospatial Catalogue Type: CSW
88+
>>> [op.name for op in csw.operations]
89+
['GetCapabilities', 'DescribeRecord', 'GetDomain', 'GetRecords', 'GetRecordById', 'GetRepositoryItem']
90+
>>> from owslib.fes import PropertyIsEqualTo, PropertyIsLike, BBox
91+
>>> query = PropertyIsEqualTo('csw:AnyText', 'Lorem ipsum')
92+
>>> csw.getrecords2(constraints=[query], maxrecords=20)
93+
>>> csw.results
94+
{'matches': 2, 'returned': 2, 'nextrecord': 0}
95+
>>> for rec in csw.records: print(csw.records[rec].abstract)
96+
Quisque lacus diam, placerat mollis, pharetra in, commodo sed, augue. Duis iaculis arcu vel arcu.
97+
None
98+
99+
Connect to the pygeoapi OGC Features API
100+
--------------------------------------------------------------------------------
101+
102+
An example of connecting to the pygeoapi demo server on OSGeoLive and retrieving a feature collection, using
103+
the OGC Features API.
104+
105+
To run the example below on OSGeoLive, first ensure the pygeoapi demo server is
106+
running. From the desktop, choose :menuselection:`Geospatial --> Web Services --> Start pygeoapi`.
107+
Then, in a terminal, run the following commands:
108+
109+
.. code-block:: bash
110+
111+
$ python3
112+
>>> from owslib.ogcapi.features import Features
113+
>>> service = Features("http://localhost:5000/")
114+
>>> feature_collections = service.feature_collections()
115+
>>> print(feature_collections)
116+
['lakes']
117+
>>> lake = service.collection_items('lakes', name='Lake Victoria')
118+
>>> import json
119+
>>> print(json.dumps(lake, indent=4))
120+
{
121+
"type": "FeatureCollection",
122+
"features": [
123+
{
124+
"type": "Feature",
125+
"properties": {
126+
"id": 6,
127+
"scalerank": 0,
128+
"name": "Lake Victoria",
129+
130+
What next?
131+
--------------------------------------------------------------------------------
132+
133+
OSGeoLive includes a set of Jupyter notebooks, including examples of OWSLib usage, and providing more
134+
details on the examples above. From the desktop, choose :menuselection:`Geospatial --> Spatial Tools --> Jupyter Notebook`.
135+
136+
The `Doing Geospatial in Python`_ workshop also includes several notebooks demonstrating OWSLib usage.
137+
138+
For more information on OWSLib, please consult the `documentation`_ on the OWSLib website.
139+
140+
.. _`documentation`: https://owslib.readthedocs.io
141+
.. _`Doing Geospatial in Python` : https://geopython.github.io/geopython-workshop/

projects_info.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ Y | geos | 3.12.2 | N | Y | Geospatial Libraries | | C/C++ Spatial Library | geo
111111
Y | geotools | NA | N | Y | Geospatial Libraries | | Java GIS Toolkit | geotools | https://geotools.org/ | OSGeo_project | GeoTools | Y
112112
Y | proj | 9.4.1 | Y | Y | Geospatial Libraries | | Coordinate Reference System Libraries | proj | https://proj.org/ | OSGeo_project | PROJ | Y
113113
# OSGeo Community | | | | | | | | | | | |
114+
Y | owslib | 0.33.0 | Y | Y | Geospatial Libraries | | Python Client for OGC Services | owslib | https://owslib.readthedocs.io/ | OSGeo_community | OWSLib | Y
114115
# Others | | | | | | | | | | | |
115116
Y | jts | NA | N | Y | Geospatial Libraries | | Java Topology Suite | jts-topo-suite | https://projects.eclipse.org/projects/locationtech.jts | | JTS | Y
116117
N | pdal | 2.6.2 | Y | Y | Geospatial Libraries | | Pointcloud and LiDAR Data Access | pdal | https://pdal.io | | PDAL | Y

0 commit comments

Comments
 (0)