Comparison Operators
The good ones go into the pot, the bad ones go into your crop
Remember Introduction, where I compared XML Filter Expressions with SQL.
Investigating WFS capabilities in GetCapabilities shows us, which comparison operations are supported by the WFS, e.g.
<fes:ComparisonOperators>
<fes:ComparisonOperator name="PropertyIsEqualTo"/>
<fes:ComparisonOperator name="PropertyIsNotEqualTo"/>
<fes:ComparisonOperator name="PropertyIsLessThan"/>
<fes:ComparisonOperator name="PropertyIsGreaterThan"/>
<fes:ComparisonOperator name="PropertyIsLessThanOrEqualTo"/>
<fes:ComparisonOperator name="PropertyIsGreaterThanOrEqualTo"/>
<fes:ComparisonOperator name="PropertyIsLike"/>
<fes:ComparisonOperator name="PropertyIsNull"/>
<fes:ComparisonOperator name="PropertyIsNil"/>
<fes:ComparisonOperator name="PropertyIsBetween"/>
</fes:ComparisonOperators>
Now, we will have a look at some Comparison Operators. As they are easy to understand, we look only at a small selection.
To do so, we will use our traffic meter WFS again.
Zaehlstellen (counting points)
ms="http://mapserver.gis.umn.edu/mapserver"
PropertyIsEqualTo
To recap, remember the Filter Expression we already used
PropertyIsEqualTo works similar to the equal operator ("=") in SQL.
Any feature which exactly matches the Filter Expresssion is returned.
PropertyIsBetween
PropertyIsBetween defines a range of values for 1 attribute by a
As our traffic meter WFS uses ascending integers for the counting point number (ZSTNR), we are able to cut out a piece like this
PropertyIsLike - Wildcards
Wildcards are really useful! The PropertyIsLike operator allows you to do pattern matching.
In our traffic meter WFS the attribute "ERFASSART" describes the type of traffic meter in combination with year dates, e.g. "2017".
Let's select all traffic meters containing "2017" in ERFASSART, no matter of the position within the description.
Let's try another example. This time parking decks in Hamburg.
verkehr_parkhaeuser (parking decks)
de.hh.up="https://registry.gdi-de.org/id/de.hh.up"
preise (de) = fees (en)
kostenlos (de) = free of charge (de)
We want to select only those parking decks with no fees at least for the first 30 minutes.
If you struggle with umlauts (ÄÖÜäöüß) in Comparison Operators, please try wildcards (PropertyIsLike) instead!