5

Is it possible to use multiple values in one Literal tag?

This is what I have:

    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>name</ogc:PropertyName>
      <ogc:Literal>0</ogc:Literal>
    </ogc:PropertyIsEqualTo>

I want to symbolize multiple attributes in one block rather than repeat the above line dozens of times. And unfortunately my table values are not very friendly so I can't use a greater than call. I was hoping for something similar to below (Literal Tag)

    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>name</ogc:PropertyName>
      <ogc:Literal>0;10;60;40</ogc:Literal>
    </ogc:PropertyIsEqualTo>

And the next Rule would be something like this:

    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>name</ogc:PropertyName>
      <ogc:Literal>1;11;62;42</ogc:Literal>
    </ogc:PropertyIsEqualTo>

2 Answers 2

4

I would go with something like:

<ogc:Function name="in">
    <ogc:PropertyName>name</ogc:PropertyName>
    <ogc:Literal>1</ogc:Literal>
    <ogc:Literal>11</ogc:Literal>
    <ogc:Literal>62</ogc:Literal>
    <ogc:Literal>42</ogc:Literal>
</ogc:Function>

Alternatively generate a new column in the database with the new classes precomputed in it.

2
  • can this be used to get the geojson data from WMS by POST request ? Dec 17, 2017 at 17:28
  • Should the whole PropertyIsEqualTo block be replaced by this?
    – BERA
    Apr 29, 2022 at 13:16
-3

You can use other operators like:

<PropertyIsEqualTo>
<PropertyIsNotEqualTo>
<PropertyIsLessThan>
<PropertyIsLessThanOrEqualTo>
<PropertyIsGreaterThan>
<PropertyIsGreaterThanOrEqualTo>

Check here the geoserver doc.

For array, check the "in" comparison function.

1
  • Those won't work because of the table.
    – risail
    May 4, 2016 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.