# WFS3 - OGC WFS 3.0 service (experimental)

(GDAL/OGR >= 2.3.0)

NOTE: THIS IS BASED ON A DRAFT VERSION OF THE WFS 3.0 SPECIFICATION

This driver can connect to a OGC WFS 3.0 service. It assumes that the service supports OpenAPI 3.0/JSON/GeoJSON encoding for respectively API description, feature collection metadata and feature collection data.

## Dataset name syntax

The syntax to open a WFS datasource is : WFS3:http://path/to/WFS/endpoint

## Layer schema

OGR needs a fixed schema per layer, but WFS 3.0 Core doesn't impose fixed schema. So the driver will first try to examine in the /api endpoint if the /{layername}/{id} path points to a schema describing properties. If not, it will retrieve the first page of features (10 features) and establish a schema from this.

Note: as a hack it is possible to point to an alternate /api endpoint with the OGR_WFS3_API_URL configuration option/environment variable.

    OGR_WFS3_API_URL=https://raw.githubusercontent.com/opengeospatial/wfs3hackathon/master/openapi.json ogrinfo WFS3:https://www.ldproxy.nrw.de/kataster flurstueck -al -q

## Filtering

The driver will forward any spatial filter set with SetSpatialFilter() to the server. In WFS 3.0 Core, only a subset of attributes allowed by the server can be queried for equalities, potentially combined with a AND logical operator. More complex requests will be partly or completely evaluated on client-side.

Rectangular spatial filtering is forward to the server as well.

## Open options

The following options are available:

- URL=url: URL to the WFS server endpoint. Required when using the "WFS:" string as the connection string.
- PAGE_SIZE=integer: Number of features to retrieve per request. Defaults to 10. Minimum is 1, maximum 10000.

## Examples

- Listing the types of a WFS server :

      $ ogrinfo WFS3:http://wfs3hackathon.ldproxy.net/rest/services/de_gn

      INFO: Open of `WFS3:http://wfs3hackathon.ldproxy.net/rest/services/de_gn'
            using driver `WFS3' successful.
      1: namedplace (Point)

- Listing the summary information of a WFS server :

      $ ogrinfo -al -so WFS3:http://wfs3hackathon.ldproxy.net/rest/services/de_gn

      INFO: Open of `WFS3:http://wfs3hackathon.ldproxy.net/rest/services/de_gn'
            using driver `WFS3' successful.

      Layer name: namedplace
      Metadata:
        DESCRIPTION=Harmonized INSPIRE Geographical Names (Annex I)
        TITLE=Named Place
      Geometry: Point
      Feature Count: 147629
      Extent: (5.866666, 47.270270) - (15.030484, 55.053446)
      Layer SRS WKT:
      GEOGCS["WGS 84",
          DATUM["WGS_1984",
              SPHEROID["WGS 84",6378137,298.257223563,
                  AUTHORITY["EPSG","7030"]],
              AUTHORITY["EPSG","6326"]],
          PRIMEM["Greenwich",0,
              AUTHORITY["EPSG","8901"]],
          UNIT["degree",0.0174532925199433,
              AUTHORITY["EPSG","9122"]],
          AUTHORITY["EPSG","4326"]]
      id: String (0.0)
      beginLifespanVersion: DateTime (0.0)
      inspireId.localId: String (0.0)
      inspireId.namespace: String (0.0)
      localType: String (0.0)
      name.language: String (0.0)
      name.sourceOfName: String (0.0)
      name.spelling.text: String (0.0)
      name.spelling.script: String (0.0)

- Filtering on a property

      $ ogrinfo WFS3:http://wfs3hackathon.ldproxy.net/rest/services/de_gn namedplace -al -q -where "\"name.spelling.text\" = 'Sandharlanden'"

      Layer name: namedplace
      Metadata:
        DESCRIPTION=Harmonized INSPIRE Geographical Names (Annex I)
        TITLE=Named Place
      OGRFeature(namedplace):1
        id (String) = NAMEDPLACE_DEBKGGND00000K72
        beginLifespanVersion (DateTime) = 2015/03/26 00:00:00
        inspireId.localId (String) = DEBKGGND00000K72
        inspireId.namespace (String) = https://registry.gdi-de.org/id/de.bund.bkg.inspire.gn250
        localType (String) = AX_Ortslage
        name.language (String) = german
        name.sourceOfName (String) = Geographische Namen 1:250.000
        name.spelling.text (String) = Sandharlanden
        name.spelling.script (String) = Latn
        POINT (11.819395 48.839015)

- Spatial filtering

      $ ogrinfo WFS3:http://wfs3hackathon.ldproxy.net/rest/services/de_gn namedplace -al -q -spat 11.85 48.82 11.86 48.83

      Layer name: namedplace
      Metadata:
        DESCRIPTION=Harmonized INSPIRE Geographical Names (Annex I)
        TITLE=Named Place
      OGRFeature(namedplace):1
        id (String) = NAMEDPLACE_DEBKGGND00001F1Q
        beginLifespanVersion (DateTime) = 2015/03/26 00:00:00
        inspireId.localId (String) = DEBKGGND00001F1Q
        inspireId.namespace (String) = https://registry.gdi-de.org/id/de.bund.bkg.inspire.gn250
        localType (String) = AX_Gemeinde
        name.language (String) = german
        name.sourceOfName (String) = Geographische Namen 1:250.000
        name.spelling.text (String) = Abensberg
        name.spelling.script (String) = Latn
        POINT (11.85305 48.828552)

  ## See Also

  - OGC WFS 3.0 Standard (DRAFT)

  - WFS (1.0,1.1,2.0) driver documentation