Archive

Tag Archives: filter standards

The OGC filter encoding standard – for whatever reason – lacks the useful IN operator we know and love from other languages like SQL [1]. Geoserver developers have therefore implemented this functionality as a non-standard SLD function [2]. Unfortunately this implementation requires prior knowledge of the number of arguments in the IN clause and it’s limited to 10 arguments.

An example filter would look like this:

<ogc:Filter>
   <ogc:PropertyIsEqualsTo>
       <ogc:Function name="in3">
          <ogc:PropertyName>first_name</ogc:PropertyName>
          <ogc:Literal>Paul</ogc:Literal>
          <ogc:Literal>Mary</ogc:Literal>
          <ogc:Literal>Luke</ogc:Literal>
       </ogc:Function>
       <ogc:Literal>true</ogc:Literal>
   </ogc:PropertyIsEqualsTo>
</ogc:Filter>

[1] https://underdark.wordpress.com/2010/06/14/the-missing-in-operator-ogc-filter-standards/
[2] http://docs.geoserver.org/stable/en/user/styling/sld-tipstricks/mixed-geometries.html#using-non-standard-sld-functions

It sounds incredible, but it’s true: OGC Filter Encoding in it’s current version 1.1 lacks an IN operator [1]. Combining multiple PropertyIsEqualTo using ORs performs really badly both on Arcgis Server [2] and Geoserver [3]. That calls for the implementation of this standard-exceeding IN operator. Maybe PropertyIsIn?

[1] http://www.opengeospatial.org/standards/filter
[2] http://viswaug.wordpress.com/2009/01/20/filter-encoding-standard-11-and-the-curious-case-of-the-missing-in-operator/
[3] https://underdark.wordpress.com/2010/06/10/dynamic-styling-and-filtering-of-a-geoserver-wms-using-openlayers-layer-wms-post/

%d bloggers like this: