Bug report #10053

OGC Binary Logical Operators evaluate only the first two operands

Added by Mathias Walker almost 6 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Expressions
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:18532

Description

In QGIS, the OGC Binary Logical Operators ogc:Or and ogc:And evaluate only the first two operands and ignore any further operands. According to the OGC filter specifications two or more operands should be supported.

This can be tested e.g. by reading a SLD style with rules containing ogc:Filter expressions with binary logical operators:

...
<sld:Rule xmlns:sld="http://www.opengis.net/sld">
  <sld:Name xmlns:sld="http://www.opengis.net/sld">Style</sld:Name>
  <sld:Title xmlns:sld="http://www.opengis.net/sld">Style</sld:Title>
  <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
    <ogc:Or xmlns:ogc="http://www.opengis.net/ogc">
      <ogc:PropertyIsEqualTo xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:PropertyName xmlns:ogc="http://www.opengis.net/ogc">type</ogc:PropertyName>
        <ogc:Literal xmlns:ogc="http://www.opengis.net/ogc">1</ogc:Literal>
      </ogc:PropertyIsEqualTo>
      <ogc:PropertyIsEqualTo xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:PropertyName xmlns:ogc="http://www.opengis.net/ogc">type</ogc:PropertyName>
        <ogc:Literal xmlns:ogc="http://www.opengis.net/ogc">2</ogc:Literal>
      </ogc:PropertyIsEqualTo>
      <ogc:PropertyIsEqualTo xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:PropertyName xmlns:ogc="http://www.opengis.net/ogc">type</ogc:PropertyName>
        <ogc:Literal xmlns:ogc="http://www.opengis.net/ogc">3</ogc:Literal>
      </ogc:PropertyIsEqualTo>
    </ogc:Or>
  </ogc:Filter>
  <sld:PolygonSymbolizer xmlns:sld="http://www.opengis.net/sld">
    <sld:Fill xmlns:sld="http://www.opengis.net/sld">
      <sld:CssParameter xmlns:sld="http://www.opengis.net/sld" name="fill">#FF0000</sld:CssParameter>
      <sld:CssParameter xmlns:sld="http://www.opengis.net/sld" name="fill-opacity">0.5</sld:CssParameter>
    </sld:Fill>
    <sld:Stroke xmlns:sld="http://www.opengis.net/sld">
      <sld:CssParameter xmlns:sld="http://www.opengis.net/sld" name="stroke">#FF0000</sld:CssParameter>
      <sld:CssParameter xmlns:sld="http://www.opengis.net/sld" name="stroke-width">0.1</sld:CssParameter>
      <sld:CssParameter xmlns:sld="http://www.opengis.net/sld" name="stroke-opacity">1</sld:CssParameter>
    </sld:Stroke>
  </sld:PolygonSymbolizer>
</sld:Rule>
...

The above rule now results in the QGIS expresssion

type = 1 OR type = 2

but should be correctly

type = 1 OR type = 2 OR type = 3

Associated revisions

Revision c8a76f8c
Added by Jürgen Fischer over 5 years ago

support ogc binary operation with more than two operands (fixes #10053)

History

#1 Updated by Jürgen Fischer over 5 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF