More

Geoserver SLD attribute-based symbology

Geoserver SLD attribute-based symbology


I have a dataset where multiple attributes need to be shown with the same symbol. I can achieve this using multiple 'PropertyIsEqualTo' operators nested within 'Or' logical operators, see below example;

  CURRENT_ST AB-LOC  CURRENT_ST ABD

This seems a little inefficient, especially considering I have about 10 different symbol types each with about 10 contributing attributes. Ideally you would just clean the attribute data up, or add a symbol field that grouped them together but that is not an option in this case.

Is there a more efficient way of doing this?

For example being able to list the attributes something like the below would be great;

 CURRENT_ST 'AB-LOC','ABD','ABC','DEF'

Geoserver provides a set of non-standard SLD functions in addition of the standard SLD features. The 'IN' operator is part of these non-standard functions. Something like that should work:

   CURRENT_ST AB-LOC ABD ABC DEF true

Note that in the functionin4,4corresponds to the number of arguments you specify. Change it according to the number of values in your list. The OGC Filter 1.0 standard used in SLD 1.0 restrains a fixed number of arguments, that's why theinfunction is provided as a serie ofinXwhereXis the actual number of arguments you have to apply.

You can have a look to this documentation page and example: http://docs.geoserver.org/stable/en/user/styling/sld-tipstricks/mixed-geometries.html#geometrytype-function


Watch the video: SLD. Geoserver, Lines