[mapserver-commits] [MapServer/MapServer] 4726b9: SLD Filters missing due to logicial keywords in ex...

Seth G noreply at github.com
Tue Oct 29 14:15:09 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/MapServer/MapServer
  Commit: 4726b9c4422806590faa798edb89861d38f32cb2
      https://github.com/MapServer/MapServer/commit/4726b9c4422806590faa798edb89861d38f32cb2
  Author: Seth G <sethg at geographika.co.uk>
  Date:   2024-10-29 (Tue, 29 Oct 2024)

  Changed paths:
    A msautotest/wxs/expected/wms_getstyles_expressions24.xml
    A msautotest/wxs/expected/wms_getstyles_expressions25.xml
    M msautotest/wxs/wms_styles_expressions.map
    M src/mapogcsld.cpp

  Log Message:
  -----------
  SLD Filters missing due to logicial keywords in expressions (#7178)

When using WMS GetStyles requests to generate SLD I noticed some filters were missing. On debugging it became apparent that any string containing a logical operator was failing to generate a filter:

```
EXPRESSION ("[Property1]" = "Not Applicable")
```

Was missing the expected filter:

```xml
<ogc:Filter><ogc:PropertyIsEqualTo><ogc:PropertyName>Property1</ogc:PropertyName><ogc:Literal>Not Applicable</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter>
```

`msSLDNumberOfLogicalOperators` had a simple search for `AND`, `NOT`, and `OR` that was finding these words in strings causing errors. This fix attempts to tokenize the string, leaving quoted strings intact to avoid this. It is by no means perfect, and I also had to change previous test cases to have spaces around keywords e.g. `(([FID] > 1)And([FID] <= 10))` so that they pass. 

MapServer seems to be missing a parsing engine for expressions (or at least I can't find anything in the codebase). Without this any SLD expression building is going to be flaky. See also #5894.



To unsubscribe from these emails, change your notification settings at https://github.com/MapServer/MapServer/settings/notifications


More information about the MapServer-commits mailing list