Filtering

The OS Features API service accepts standard OGC XML filter parameters and can be applied following the normal OGC filter structure. When constructing an attribute-based filter, any attribute returned in the DescribeFeatureType response is a valid candidate.

For example, to return all Topography_TopographicArea features with a DescriptiveGroup of Roadside, a user would submit a GetFeature request with a typeNames parameter of Topography_TopographicArea, and a filter parameter like this:

<ogc:Filter>
  <ogc:PropertyIsEqualTo>
    <ogc:PropertyName>DescriptiveGroup</ogc:PropertyName>
    <ogc:Literal>Roadside</ogc:Literal>
  </ogc:PropertyIsEqualTo>
</ogc:Filter>

Note:

If you want to combine both a bounding box and another filter each should be included in a single OGC filter parameter. If you combine a purely attribute-based OGC filter (as above) with a bounding box via the bbox request parameter, the bbox request parameter takes precedence and the attribute filter is ignored.

A combined bounding box and attribute filter might look something like this:

<ogc:Filter>
  <ogc:And>
    <ogc:Within>
      <PropertyName>SHAPE</PropertyName>
      <gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:27700">
        <gml:coordinates decimal="." cs="," ts=",">
          436833.50,115334.90,437643.25,115761.50
        </gml:coordinates>
      </gml:Box>
    </ogc:Within>
    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>DescriptiveGroup</ogc:PropertyName>
      <ogc:Literal>Roadside</ogc:Literal>
    </ogc:PropertyIsEqualTo>
  </ogc:And>
</ogc:Filter>

Last updated