File: wfs-wei-script.py

package info (click to toggle)
owslib 0.35.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,772 kB
  • sloc: xml: 143,288; python: 24,542; makefile: 15
file content (29 lines) | stat: -rw-r--r-- 938 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Juergen Weichand'


from owslib.wfs import WebFeatureService

wfs = WebFeatureService(url='http://geoserv.weichand.de:8080/geoserver/wfs', version='2.0.0', timeout=30)

# List StoredQueries
print('\nStoredQueries for %s' % wfs.identification.title)
for storedquery in wfs.storedqueries:
    print(storedquery.id, storedquery.title)

# List Parameter for a given StoredQuery
storedquery = wfs.storedqueries[5]
print('\nStoredQuery parameters for %s' % storedquery.id)
for parameter in storedquery.parameters:
    print(parameter.name, parameter.type)

# GetFeature StoredQuery
print('\nDownload data from %s' % wfs.identification.title)
response = wfs.getfeature(
    storedQueryID='GemeindeByGemeindeschluesselEpsg31468',
    storedQueryParams={'gemeindeschluessel':'09162000'})
out = open('/tmp/test-storedquery.gml', 'wb')
out.write(response.read())
out.close()
print('... done')