HOW TO

Filter features in ArcGIS WFS using an attribute-based XML (FES 2.0) filter

Last Published: March 18, 2026

Summary

ArcGIS Server supports OGC-compliant Web Feature Service (WFS) queries. When retrieving specific features using attribute filters (for example, CITY_NAME = 'Los Angeles'), ArcGIS Server requires the use of an XML-based filter that complies with the OGC Filter Encoding Specification (FES) 2.0 (Filter Encoding Standard – Encoding Syntax for Geospatial Queries), encoded in the FILTER parameter of a GetFeature request.

This article demonstrates how to construct and use such a request using the publicly available SampleWorldCities WFS service.

Cause

Using unsupported filters (e.g. CQL_FILTER) or omitting required XML syntax causes errors like InvalidParameterValue or returns unfiltered data.

Procedure

Retrieve the feature where CITY_NAME = 'Los Angeles' from the Cities layer of the WFS.

GetCapabilities Request

Before querying a WFS, it is recommended to inspect its capabilities to identify available layers and supported operations:

https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer?request=getcapabilities&service=wfs

Use DescribeFeatureType to Identify Attribute Names

Once the target layer is known, retrieve its schema to determine the exact attribute names:

https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer?SERVICE=WFS&VERSION=2.0.0&REQUEST=DescribeFeatureType&TYPENAMES=SampleWorldCities:Cities

Retrieve All Features

The following request returns all features from the Cities layer:

https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=SampleWorldCities:Cities&SRSNAME=urn:ogc:def:crs:EPSG::4326&OUTPUTFORMAT=geojson

Retrieve Filtered Features (Attribute Query)

To retrieve only features matching a specific attribute condition (for example, CITY_NAME = 'Los Angeles'), you must include a FES 2.0-compliant XML filter in the FILTER parameter.

XML Filter (Readable Format)

<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0">
  <fes:PropertyIsEqualTo>
    <fes:ValueReference>CITY_NAME</fes:ValueReference>
    <fes:Literal>Los Angeles</fes:Literal>
  </fes:PropertyIsEqualTo>
</fes:Filter>

URL-Encoded Filtered Request

The XML filter must be URL-encoded before being appended to the request:

https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=SampleWorldCities:Cities&SRSNAME=urn:ogc:def:crs:EPSG::4326&OUTPUTFORMAT=geojson&FILTER=%3Cfes%3AFilter%20xmlns%3Afes%3D%22http%3A%2F%2Fwww.opengis.net%2Ffes%2F2.0%22%3E%0A%20%20%3Cfes%3APropertyIsEqualTo%3E%0A%20%20%20%20%3Cfes%3AValueReference%3ECITY_NAME%3C%2Ffes%3AValueReference%3E%0A%20%20%20%20%3Cfes%3ALiteral%3ELos%20Angeles%3C%2Ffes%3ALiteral%3E%0A%20%20%3C%2Ffes%3APropertyIsEqualTo%3E%0A%3C%2Ffes%3AFilter%3E

Key Notes

  • The FILTER parameter must contain valid FES 2.0 XML.
  • The XML must be URL-encoded when appended to a GetFeature request via the FILTER parameter.
  • Field names (for example, CITY_NAME) must match exactly those defined in the WFS schema.
  • String comparisons are case-sensitive depending on the underlying data source.
  • Always verify supported properties and namespaces using the GetCapabilities document.

Article ID: 000037133

Get support with AI

Resolve your issue quickly with the Esri Support AI Chatbot.

Start chatting now

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Start chatting now

Go to download options