83
83
---
84
84
Connect to a WFS and inspect its capabilities.
85
85
86
- ::
86
+ .. code-block :: python
87
87
88
88
>> > from owslib.wfs import WebFeatureService
89
- >>> wfs11 = WebFeatureService(url='http ://geoserv.weichand.de:8080/geoserver /wfs', version='1.1 .0')
90
- >>> wfs11 .identification.title
91
- 'INSPIRE WFS 2.0 DemoServer Verwaltungsgrenzen Bayern
89
+ >> > wfs20 = WebFeatureService(url = ' https ://services.rce.geovoorziening.nl/dijken /wfs' , version = ' 2.0 .0' )
90
+ >> > wfs20 .identification.title
91
+ ' Landschapsatlas '
92
92
93
- >>> [operation.name for operation in wfs11.operations]
94
- ['GetCapabilities', 'DescribeFeatureType', 'GetFeature', 'GetGmlObject']
93
+ >> > [operation.name for operation in wfs20.operations]
94
+ [' GetCapabilities' , ' DescribeFeatureType' , ' GetFeature' , ' GetPropertyValue' , ' ListStoredQueries' , ' DescribeStoredQueries' ,
95
+ ' CreateStoredQuery' , ' DropStoredQuery' , ' ImplementsBasicWFS' , ' ImplementsTransactionalWFS' , ' ImplementsLockingWFS' ,
96
+ ' KVPEncoding' , ' XMLEncoding' , ' SOAPEncoding' , ' ImplementsInheritance' , ' ImplementsRemoteResolve' , ' ImplementsResultPaging' ,
97
+ ' ImplementsStandardJoins' , ' ImplementsSpatialJoins' , ' ImplementsTemporalJoins' , ' ImplementsFeatureVersioning' ,
98
+ ' ManageStoredQueries' , ' PagingIsTransactionSafe' , ' QueryExpressions' ]
95
99
96
100
List FeatureTypes
97
101
98
- ::
102
+ .. code-block :: python
99
103
100
- >>> list(wfs11 .contents)
101
- ['bvv:vg_ex ', 'bvv:bayern_ex', 'bvv:lkr_ex', 'bvv:regbez_ex', 'bvv:gmd_ex ']
104
+ >> > list (wfs20 .contents)
105
+ [' dijken:dijken_bovenregionale_betekenis ' , ' dijken:dijklijnenkaart_rce ' ]
102
106
103
107
Download GML using ``typename ``, ``bbox `` and ``srsname ``.
104
108
105
- ::
109
+ .. code-block :: python
106
110
107
111
>> > # OWSLib will switch the axis order from EN to NE automatically if designated by EPSG-Registry
108
- >>> response = wfs11.getfeature(typename='bvv:gmd_ex', bbox=(4500000,5500000,4500500,5500500), srsname='urn:x-ogc:def:crs:EPSG:31468')
112
+ >> > response = wfs20.getfeature(typename = ' dijken:dijklijnenkaart_rce' , bbox = (173700 ,440400 ,178700 ,441400 ), srsname = ' EPSG:28992' )
113
+ >> > str (response.read())
114
+ ' b\' <?xml version="1.0" encoding="UTF-8"?><dijken:dijklijnenkaart_rce...\' '
115
+
116
+ Download in other formats (if supported by server).
117
+
118
+ .. code-block :: python
119
+
120
+ >> > response = wfs20.getfeature(typename = ' dijken:dijklijnenkaart_rce' , bbox = (173700 ,440400 ,178700 ,441400 ), srsname = ' EPSG:28992' , outputFormat = ' application/json' )
121
+ >> > response.read()
122
+ b ' {"type":"FeatureCollection","features":...'
109
123
110
124
Return a FeatureType's schema via ``DescribeFeatureType ``. The dictionary returned is
111
125
compatible with a `Fiona schema object <https://fiona.readthedocs.io/en/latest/fiona.html#fiona.collection.Collection.schema >`_.
112
126
113
- ::
127
+ .. code-block :: python
128
+
129
+ >> > wfs20.get_schema(' dijken:dijklijnenkaart_rce' )
130
+ {' properties' : {' ogc_fid' : ' int' , ' id' : ' string' , ' naam' : ' string' , ' aanleg_beg' : ' string' , ' aanleg_ein' : ' string' , ' aanleg_ind' : ' string' , ' status' : ' string' , ' herkomst' : ' string' , ' verdwenen' : ' string' , ' oorsprfunc' : ' string' , ' naspfunc' : ' string' , ' bijzonderh' : ' string' , ' bron_data' : ' string' , ' bron_id' : ' string' , ' bron_geo' : ' string' , ' rce_zone' : ' string' , ' waternaam' : ' string' , ' polder' : ' string' , ' shape_leng' : ' double' , ' opmerking' : ' string' , ' laatst_bew' : ' date' }, ' required' : [' ogc_fid' ], ' geometry' : ' GeometryCollection' , ' geometry_column' : ' wkb_geometry' }
114
131
115
- >>> wfs11.get_schema('bvv:vg_ex')
116
- >>> {'properties': {'land': 'string', 'modellart': 'string', 'objart': 'string', 'objart_txt': 'string', 'objid': 'string', 'hdu_x': 'short', 'beginn': 'string', 'ende': 'string', 'adm': 'string', 'avg': 'string', 'bez_gem': 'string', 'bez_krs': 'string', 'bez_lan': 'string', 'bez_rbz': 'string', 'sch': 'string'}, 'geometry': '3D MultiPolygon', 'geometry_column': 'geom'}
117
132
118
133
Download GML using ``typename `` and ``filter ``. OWSLib currently only
119
134
support filter building for WFS 1.1 (FE.1.1).
120
135
121
- ::
136
+ .. code-block :: python
122
137
123
138
>> > from owslib.fes import *
124
139
>> > from owslib.etree import etree
125
140
>> > from owslib.wfs import WebFeatureService
126
- >>> wfs11 = WebFeatureService(url='http ://geoserv.weichand.de:8080/geoserver /wfs', version='1.1.0')
141
+ >> > wfs10 = WebFeatureService(url = ' https ://services.rce.geovoorziening.nl/dijken /wfs' , version = ' 1.1.0' )
127
142
128
- >>> filter = PropertyIsLike(propertyname='bez_gem ', literal='Ingolstadt ', wildCard='*')
143
+ >> > filter = PropertyIsLike(propertyname = ' naam ' , literal = ' Haarlemmer* ' , wildCard = ' *' )
129
144
>> > filterxml = etree.tostring(filter .toXML()).decode(" utf-8" )
130
- >>> response = wfs11 .getfeature(typename='bvv:gmd_ex ', filter=filterxml)
145
+ >> > response = wfs10 .getfeature(typename = ' dijken:dijklijnenkaart_rce ' , filter = filterxml)
131
146
132
147
Save response to a file.
133
148
134
- ::
149
+ .. code-block :: python
135
150
136
151
>> > out = open (' /tmp/data.gml' , ' wb' )
137
152
>> > out.write(bytes (response.read(), ' UTF-8' ))
@@ -140,21 +155,22 @@ Save response to a file.
140
155
Download GML using ``StoredQueries ``\ (only available for WFS 2.0
141
156
services)
142
157
143
- ::
158
+ .. code-block :: python
144
159
145
160
>> > from owslib.wfs import WebFeatureService
146
- >>> wfs20 = WebFeatureService(url='http ://geoserv.weichand.de:8080/geoserver /wfs', version='2.0.0')
161
+ >> > wfs20 = WebFeatureService(url = ' https ://services.rce.geovoorziening.nl/dijken /wfs' , version = ' 2.0.0' )
147
162
148
163
>> > # List StoredQueries
149
164
>> > [storedquery.id for storedquery in wfs20.storedqueries]
150
- ['bboxQuery', ' urn:ogc:def:query:OGC-WFS::GetFeatureById', 'GemeindeByGemeindeschluesselEpsg31468', 'DWithinQuery ']
165
+ [' urn:ogc:def:query:OGC-WFS::GetFeatureById' ]
151
166
152
- >>> # List Parameters for StoredQuery[1 ]
153
- >>> parameter.name for parameter in wfs20.storedqueries[1 ].parameters]
167
+ >> > # List Parameters for StoredQuery[0 ]
168
+ >> > [ parameter.name for parameter in wfs20.storedqueries[0 ].parameters]
154
169
[' ID' ]
155
170
156
-
157
- >>> response = wfs20.getfeature(storedQueryID='urn:ogc:def:query:OGC-WFS::GetFeatureById', storedQueryParams={'ID':'gmd_ex.1'})
171
+ >> > response = wfs20.getfeature(storedQueryID = ' urn:ogc:def:query:OGC-WFS::GetFeatureById' , storedQueryParams = {' ID' :' dijklijnenkaart_rce.13364' })
172
+ >> > str (response.read())
173
+ ' b\' <?xml version="1.0" encoding="UTF-8"?><dijken:dijklijnenkaart_rce...\' '
158
174
159
175
OGC API
160
176
-------
0 commit comments