Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expressions containing <> do not throw parsing errors #6950

Open
geographika opened this issue Oct 19, 2023 · 0 comments
Open

Expressions containing <> do not throw parsing errors #6950

geographika opened this issue Oct 19, 2023 · 0 comments

Comments

@geographika
Copy link
Member

I ran into this issue when checking SLD output from LAYER CLASS EXPRESSIONS.

I'd not thoroughly read the logical expression docs and so had been unaware that NOT expressions in MapServer can be represented by != or ne, but not <>.

The following layer parses fine in MapServer, but the <> gets parsed as MS_TOKEN_COMPARISON_LT and MS_TOKEN_COMPARISON_GT in

case MS_TOKEN_COMPARISON_NE:

    LAYER
      NAME "Test18"    
      TYPE POINT
      CLASS
        EXPRESSION ( [FID] <> 1 AND [FID] <> 10 )
        STYLE
            COLOR 220 0 0
            WIDTH 1
        END
      END
    END

This probably causes strange issues when rendering data, but is more noticeable when generating SLD as it returns:

  <ogc:Filter>
    <ogc:And>
      <ogc:PropertyIsLessThan>
        <ogc:PropertyName>FID</ogc:PropertyName>
        <ogc:Literal>> 1</ogc:Literal>
      </ogc:PropertyIsLessThan>
      <ogc:PropertyIsLessThan>
        <ogc:PropertyName>FID</ogc:PropertyName>
        <ogc:Literal>> 10 </ogc:Literal>
      </ogc:PropertyIsLessThan>
    </ogc:And>
  </ogc:Filter>

Ideally I think the MapServer expression parser should throw an error when reading the Mapfile (or we attempt to support <> in expressions).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant