File: wfs_MapServerWFSFeature.txt

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 (20 lines) | stat: -rw-r--r-- 716 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Imports

    >>> from owslib.wfs import WebFeatureService
    
Test the getfeature method

    >>> wfs = WebFeatureService('http://nsidc.org/cgi-bin/atlas_south?', version='1.0.0')
    >>> response = wfs.getfeature(typename=['glaciers'], maxfeatures=5)
    >>> response.read().find(b'<wfs:FeatureCollection') > 0
    True

Handle service exception

    >>> from owslib.util import ServiceException
    >>> try:
    ...     response = wfs.getfeature(typename=['totally bogus'], maxfeatures=5)
    ... except ServiceException as e:
    ...     assert "msWFSGetFeature(): WFS server error. TYPENAME 'totally bogus' doesn't exist in this server.  Please check the capabilities and reformulate your request." in str(e)