Coverage for gws-app/gws/plugin/ows_client/wfs/__init__.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-05 13:35 +0200

1"""WFS client. 

2 

3Uses the feature types of a remote WFS service as vector layers, search 

4sources and models. Requests are built for WFS 1.x or WFS 2.0, depending on 

5the version reported in the capabilities. 

6 

7Submodules: 

8 

9- ``provider``: the WFS service provider. Reads the capabilities and runs 

10 GetFeature requests. 

11- ``caps``: parser for the WFS capabilities document. Each feature type 

12 becomes a queryable source layer. 

13- ``layer``: the ``wfs`` tree layer, a group with a ``wfsflat`` child layer 

14 for each feature type. 

15- ``flatlayer``: the ``wfsflat`` vector layer that shows the features of a 

16 single feature type. 

17- ``finder``: the ``wfs`` finder that searches feature types by geometry. 

18- ``model``: the ``wfs`` read-only model that reads features from feature types. 

19 

20The ``wfsflat`` layer creates a ``wfs`` model and a ``wfs`` finder for its 

21feature type, unless models or finders are configured explicitly. Unless 

22configured otherwise, it uses the WGS84 extent of the feature type and, if 

23there is exactly one source layer, its metadata. The ``wfs`` tree layer uses 

24the service metadata, unless metadata is configured. 

25 

26GetFeature requests are spatial only: the provider requests the features 

27within the bounds of the search shape (enlarged by the search tolerance) with 

28a ``BBOX`` parameter and then filters them on the GWS side by intersecting 

29them with the shape. This is faster than WFS spatial operators (at least with 

30QGIS Server) and works with any WFS server, including those without support 

31for spatial filters. A search without bounds or shape returns nothing. 

32Requests are sent in the forced CRS of the provider, or in WGS84. For WFS 2 

33the CRS is appended to the ``BBOX`` value by default, which can be changed 

34with ``withBboxCrs``. 

35 

36References: 

37 

38- WFS 1.0.0: http://portal.opengeospatial.org/files/?artifact_id=7176 Sec 13.7.3 

39- WFS 1.1.0: http://portal.opengeospatial.org/files/?artifact_id=8339 Sec 14.7.3 

40- WFS 2.0.0: http://docs.opengeospatial.org/is/09-025r2/09-025r2.html Sec 11.1.3 

41- https://docs.geoserver.org/latest/en/user/services/wfs/reference.html 

42 

43Example:: 

44 

45 map.layers+ { 

46 title "Districts" 

47 type "wfsflat" 

48 provider.url "https://example.com/wfs" 

49 sourceLayers.names ["ns:districts"] 

50 } 

51 

52 map.layers+ { 

53 title "All feature types" 

54 type "wfs" 

55 provider.url "https://example.com/wfs" 

56 } 

57"""