Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for Qt

Load WFS with XML query

Sample Viewer View Sample on GitHub

Load a WFS feature table using an XML query.

Use case

Runtime QueryParameters objects can't represent all possible queries that can be made against a WFS feature service. For example, Runtime query parameters don't support wildcard searches. You can provide queries as raw XML strings, allowing you to access query functionality not available with QueryParameters.

How to use the sample

Run the sample and view the data loaded from the the WFS feature table.

How it works

  1. Create a WfsFeatureTable and a FeatureLayer to visualize the table.
  2. Set the feature request mode to ManualCache.
  3. Call populateFromServiceWithXml to populate the table with only those features returned by the XML query.

Relevant API

  • FeatureLayer
  • WfsFeatureTable
  • WfsFeatureTable.axisOrder
  • WfsFeatureTable.populateFromServiceWithXml

About the data

This service shows trees in downtown Seattle and the surrounding area. An XML-encoded GetFeature request is used to limit results to only trees of the genus Tilia.

For additional information, see the underlying service on ArcGIS Online.


feature, OGC, query, service, web, WFS, XML

Sample Code

import QtQuick 2.6
import Esri.ArcGISRuntime 100.9

Rectangle {
    id: rootRectangle
    clip: true
    width: 800
    height: 600

    readonly property string xmlQueryString :
     <wfs:GetFeature service="WFS" version="2.0.0"
     <wfs:Query typeNames="Seattle_Downtown_Features:Trees">
     <fes:PropertyIsLike wildCard="*" escapeChar="\">
     <fes:Literal>Tilia *</fes:Literal>

    MapView {
        id: mapView
        anchors.fill: parent

        Map {
            BasemapNavigationVector {}

            FeatureLayer {
                WfsFeatureTable {
                    id: wfsFeatureTable
                    url: ""
                    tableName: "Seattle_Downtown_Features:Trees"
                    featureRequestMode: Enums.FeatureRequestModeManualCache
                    onLoadStatusChanged: {
                        if (loadStatus !== Enums.LoadStatusLoaded)

                        // populate the table with XML Query
                        populateFromServiceWithXml(xmlQueryString, true);

                        // set the viewpoint to the center of the extent
                        mapView.setViewpointGeometryAndPadding(extent, 50);