0

This below section in SLD worked ok in 2.10 Geoserver, where it did not include any records from that layer.

<Filter>
  <Or />
</Filter>

However, This does not work in GetMap of GeoServer 2.20. It shows the "Rendering process failed" error.

Does anyone know what to pass in this filter node so that, the layer features are ignored in the final print? I have tried an empty filter node, does not work and loads all features from the layer.

<Filter>
</Filter>

2 Answers 2

1

I'm not sure I've ever tried to exclude a whole layer but I would expect something like:

     <ogc:Filter>
        <ogc:PropertyIsEqualTo>
          <ogc:Literal>1</ogc:Literal>
          <ogc:Literal>0</ogc:Literal>
        </ogc:PropertyIsEqualTo>
      </ogc:Filter>

would work.

3
  • I get this error : "java.lang.RuntimeException: org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 21; The prefix "ogc" for element "ogc:Filter" is not bound. org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 21; The prefix "ogc" for element "ogc:Filter" is not bound. The prefix "ogc" for element "ogc:Filter" is not bound." However, this works: <Filter> <PropertyIsEqualTo> <Literal>1</Literal> <Literal>0</Literal> </PropertyIsEqualTo> </Filter> Is it absolutely required to have"ogc:" in the Filter node? Oct 27, 2022 at 20:00
  • It would depend on how you had set your namespaces, I usually have sld as my default and use ogc for the filter spec, but you could do it the other way around if you like
    – Ian Turton
    Oct 28, 2022 at 8:21
  • Sure, it's clear now. Since this SLD was generated from c# code using classes, I was not able to put 2 "Literal" property in same class, I used something like this and it works <Filter> <Or> <PropertyIsEqualTo> <PropertyName>id</PropertyName> <Literal>-1</Literal> </PropertyIsEqualTo> </Or> </Filter> Oct 28, 2022 at 8:26
0

Alternatively even the below Filter works

  <Filter>
    <Or>
      <PropertyIsEqualTo>
        <PropertyName>id</PropertyName>
        <Literal>-1</Literal>
      </PropertyIsEqualTo>
    </Or>
  </Filter>

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.