Web Feature Service (WFS) ========================= The **1.0.0** and **1.1.0** WFS standards implemented in QGIS Server provide a HTTP interface to query geographic features from a QGIS project. A typical WFS request defines the QGIS project to use and the layer to query. Specifications document according to the version number of the service: - `WFS 1.0.0 `_ - `WFS 1.1.0 `_ Standard requests provided by QGIS Server: .. csv-table:: :header: "Request", "Description" :widths: auto ":ref:`GetCapabilities `", "Returns XML metadata with information about the server" ":ref:`GetFeature `", "Returns a selection of features" ":ref:`DescribeFeatureType `", "Returns a description of feature types and properties" ":ref:`Transaction `", "Allows features to be inserted, updated or deleted" .. _wfs_getcapabilities: GetCapabilities --------------- Standard parameters for the **GetCapabilities** request according to the OGC WFS 1.0.0 and 1.1.0 specifications: .. csv-table:: :header: "Parameter", "Required", "Description" :widths: auto ":ref:`SERVICE `", "Yes", "Name of the service (**WFS**)" ":ref:`REQUEST `", "Yes", "Name of the request (**GetCapabilities**)" ":ref:`VERSION `", "No", "Version of the service" In addition to the standard ones, QGIS Server supports the following extra parameters: .. csv-table:: :header: "Parameter", "Required", "Description" :widths: auto ":ref:`MAP `", "Yes", "QGIS project file" .. _wfs_version: VERSION ^^^^^^^ This parameter allows to specify the version of the service to use. Available values for the ``VERSION`` parameter are: - ``1.0.0`` - ``1.1.0`` If no version is indicated in the request, then ``1.1.0`` is used by default. URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &VERSION=1.1.0 &... .. _wfs_getfeature: GetFeature ---------- Standard parameters for the **GetFeature** request according to the OGC WFS 1.0.0 and 1.1.0 specifications: .. csv-table:: :header: "Parameter", "Required", "Description" :widths: auto ":ref:`SERVICE `", "Yes", "Name of the service (**WFS**)" ":ref:`REQUEST `", "Yes", "Name of the request (**GetFeature**)" ":ref:`VERSION `", "No", "Version of the service" ":ref:`TYPENAME `", "No", "Name of layers" ":ref:`FEATUREID `", "No", "Filter the features by ids" ":ref:`OUTPUTFORMAT `", "No", "Output Format" ":ref:`RESULTTYPE `", "No", "Type of the result" ":ref:`PROPERTYNAME `", "No", "Name of properties to return" ":ref:`MAXFEATURES `", "No", "Maximum number of features to return" ":ref:`SRSNAME `", "No", "Coordinate reference system" ":ref:`FILTER `", "No", "OGC Filter Encoding" ":ref:`BBOX `", "No", "Map Extent" ":ref:`SORTBY `", "No", "Sort the results" In addition to the standard ones, QGIS Server supports the following extra parameters: .. csv-table:: :header: "Parameter", "Required", "Description" :widths: auto ":ref:`MAP `", "Yes", "QGIS project file" ":ref:`STARTINDEX `", "No", "Paging" ":ref:`GEOMETRYNAME `", "No", "Type of geometry to return" ":ref:`EXP_FILTER `", "No", "Expression filtering" .. _wfs_getfeature_typename: TYPENAME ^^^^^^^^ This parameter allows to specify layer names and is mandatory if ``FEATUREID`` is not set. URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &VERSION=1.1.0 &REQUEST=GetFeature &TYPENAME=countries .. _wfs_getfeature_featureid: FEATUREID ^^^^^^^^^ This parameter allows to specify the ID of a specific feature and is formed like ``typename.fid,typename.fid,...``. URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &REQUEST=GetFeature &FEATUREID=countries.0,places.1 XML response: .. code-block:: xml ... ... ... .. _wfs_getfeature_outputformat: OUTPUTFORMAT ^^^^^^^^^^^^ This parameter may be used to specify the format of the response. If ``VERSION`` is greater or equal than ``1.1.0``, GML3 is the default format. Otherwise GML2 is used. Available values are: - ``gml2`` - ``text/xml; subtype=gml/2.1.2`` - ``gml3`` - ``text/xml; subtype=gml/3.1.1`` - ``geojson`` - ``application/vnd.geo+json``, - ``application/vnd.geo json`` - ``application/geo+json`` - ``application/geo json`` - ``application/json`` URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &REQUEST=GetFeature &FEATUREID=countries.0 &OUTPUTFORMAT=geojson GeoJSON response: .. code-block:: json { "type":"FeatureCollection", "bbox":[ -180, -90, 180, 83.6236 ], "features":[ { "bbox":[ -61.891113, 16.989719, -61.666389, 17.724998 ], "geometry":{ "coordinates":[ "..." ], "type":"MultiPolygon" }, "id":"countries.1", "properties":{ "id":1, "name":"Antigua and Barbuda" }, "type":"Feature" } ] } .. _wfs_getfeature_resulttype: RESULTTYPE ^^^^^^^^^^ This parameter may be used to specify the kind of result to return. Available values are: - ``results``: the default behavior - ``hits``: returns only a feature count URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &VERSION=1.1.0 &REQUEST=GetFeature &RESULTTYPE=hits &... .. _wfs_getfeature_propertyname: PROPERTYNAME ^^^^^^^^^^^^ This parameter may be used to specify a specific property to return. A property needs to be mapped with a ``TYPENAME`` or a ``FEATUREID``: Valid URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &REQUEST=GetFeature &PROPERTYNAME=name &TYPENAME=places On the contrary, the next URL will return an exception: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &REQUEST=GetFeature &PROPERTYNAME=name &TYPENAME=places,countries .. code-block:: xml There has to be a 1:1 mapping between each element in a TYPENAME and the PROPERTYNAME list .. _wfs_getfeature_maxfeatures: MAXFEATURES ^^^^^^^^^^^ This parameter allows to limit the number of features returned by the request. .. note:: This parameter may be useful to improve performances when underlying vector layers are heavy. .. _wfs_getfeature_srsname: SRSNAME ^^^^^^^ This parameter allows to indicate the response output Spatial Reference System as well as the ``BBOX`` CRS and has to be formed like ``EPSG:XXXX``. .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &REQUEST=GetFeature &TYPENAME=places &SRSNAME=EPSG:32620 .. _wfs_getfeature_filter: FILTER ^^^^^^ This parameter allows to filter the response with the **Filter Encoding** language defined by the `OGC Filter Encoding standard `_. For example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS& REQUEST=GetFeature& TYPENAME=places& FILTER=nameParis In case of multiple typenames, filters have to be enclosed in parentheses: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &REQUEST=GetFeature &TYPENAME=places,countries &FILTER=(nameParis)(nameFrance) .. _wfs_getfeature_bbox: BBOX ^^^^ This parameter allows to specify the map extent with units according to the current CRS. Coordinates have to be separated by a comma. The ``SRSNAME`` parameter may specify the CRS of the extent. If not specified, the CRS of the layer is used. URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &REQUEST=GetFeature &TYPENAME=places &BBOX=-11.84,42.53,8.46,50.98 The ``FEATUREID`` parameter cannot be used with the ``BBOX``. Any attempt will result in an exception: .. code-block:: xml FEATUREID FILTER and BBOX parameters are mutually exclusive .. _wfs_getfeature_sortby: SORTBY ^^^^^^ This parameter allows to sort resulting features according to property values and has to be formed like ``propertyname SORTRULE``. Available values for ``SORTRULE`` in case of descending sorting: - ``D`` - ``+D`` - ``DESC`` - ``+DESC`` Available values for ``SORTRULE`` in case of ascending sorting: - ``A`` - ``+A`` - ``ASC`` - ``+ASC`` URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &REQUEST=GetFeature &TYPENAME=places &PROPERTYNAME=name &MAXFEATURES=3 &SORTBY=name DESC The corresponding result: .. code-block:: xml ... Zagreb Yerevan Yaounde .. _wfs_getfeature_geometryname: GEOMETRYNAME ^^^^^^^^^^^^ This parameter can be used to specify the kind of geometry to return for features. Available values are: - ``extent`` - ``centroid`` - ``bash`` URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &VERSION=1.1.0 &REQUEST=GetFeature &GEOMETRYNAME=centroid &... .. _wfs_getfeature_startindex: STARTINDEX ^^^^^^^^^^ This parameter is standard in WFS 2.0, but it's an extension for WFS 1.0.0. Actually, it can be used to skip some features in the result set and in combination with ``MAXFEATURES``, it provides the ability to page through results. URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &VERSION=1.1.0 &REQUEST=GetFeature &STARTINDEX=2 &... .. _wfs_getfeature_expfilter: EXP_FILTER ^^^^^^^^^^ This parameter allows to filter the response with QGIS expressions. The ``;`` character is used to separate filters in case of multiple typenames. URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &REQUEST=GetFeature &TYPENAME=places,countries &EXP_FILTER="name"='Paris';"name"='France' .. _wfs_describefeaturetype: DescribeFeatureType ------------------- Standard parameters for the **DescribeFeatureType** request according to the OGC WFS 1.0.0 and 1.1.0 specifications: .. csv-table:: :header: "Parameter", "Required", "Description" :widths: auto ":ref:`SERVICE `", "Yes", "Name of the service (**WFS**)" ":ref:`REQUEST `", "Yes", "Name of the request (**DescribeFeatureType**)" ":ref:`VERSION `", "No", "Version of the service" ":ref:`OUTPUTFORMAT `", "No", "Format of the response" ":ref:`TYPENAME `", "No", "Name of layers" In addition to the standard ones, QGIS Server supports the following extra parameters: .. csv-table:: :header: "Parameter", "Required", "Description" :widths: auto ":ref:`MAP `", "Yes", "QGIS project file" URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &VERSION=1.1.0 &REQUEST=DescribeFeatureType &TYPENAME=countries Output response: .. code-block:: xml .. _wfs_transaction: Transaction ----------- This request allows to update, delete or add one or several features thanks to a XML document. The :ref:`delete ` action may be achieved with a POST request as well as with the :ref:`OPERATION ` parameter while the :ref:`add ` and the :ref:`update ` operations may be achieved through POST request only. Standard parameters for the **Transaction** request according to the OGC WFS 1.0.0 and 1.1.0 specifications: .. csv-table:: :header: "Parameter", "Required", "Description" :widths: auto ":ref:`SERVICE `", "Yes", "Name of the service (**WFS**)" ":ref:`REQUEST `", "Yes", "Name of the request (**Transaction**)" ":ref:`VERSION `", "No", "Version of the service" ":ref:`FILTER `", "No", "OGC Filter Encoding" ":ref:`BBOX `", "No", "Map Extent" ":ref:`FEATUREID `", "No", "Filter the features by ids" ":ref:`TYPENAME `", "No", "Name of layers" In addition to the standard ones, QGIS Server supports the following extra parameters: .. csv-table:: :header: "Parameter", "Required", "Description" :widths: auto ":ref:`MAP `", "Yes", "QGIS project file" ":ref:`OPERATION `", "No", "Specify the operation" ":ref:`EXP_FILTER `", "No", "Expression filtering" .. _wfs_transaction_operation: OPERATION ^^^^^^^^^ This parameter allows to delete a feature without using a POST request with a dedicated XML document. URL example: .. code-block:: bash http://localhost/qgisserver? SERVICE=WFS &VERSION=1.1.0 &REQUEST=Transaction &OPERATION=DELETE &FEATUREID=24 .. note:: ``FEATUREID``, ``BBOX`` and ``FILTER`` parameters are mutually exclusive and prioritized in this order. .. _wfs_transaction_add: Add features ^^^^^^^^^^^^ POST request example: .. code-block:: bash wget --post-file=add.xml "http://localhost/qgisserver?SERVICE=WFS&REQUEST=Transaction" with the *add.xml* document: .. code-block:: xml -4.6167,48.3833 Locmaria-Plouzané .. _wfs_transaction_update: Update features ^^^^^^^^^^^^^^^ POST request example: .. code-block:: bash wget --post-file=update.xml "http://localhost/qgisserver?SERVICE=WFS&REQUEST=Transaction" with the *update.xml* document: .. code-block:: xml name Lutece .. _wfs_transaction_delete: Delete features ^^^^^^^^^^^^^^^ POST request example: .. code-block:: bash wget --post-file=delete.xml "http://localhost/qgisserver?SERVICE=WFS&REQUEST=Transaction" with the *delete.xml* document: .. code-block:: xml