Monday 25 February 2019

geoserver - Creating point symbology in SLD file


I would like to create a style file for a layer in Geoserver. I have point geometries and the SLD cookbook does give nice examples for the simple ways to create your symbology.


However, I would like to combine the attribute dependent way and the scale dependent way. My points need to be colored depending on some attribute value and change size depending on the zoom level.


Does anybody have an example on how to do this or even some link where more complicated version of SDL files are available?



Answer




With Rule based SLDs, you need to set up a rule for each case. You cannot nest rules.


In the following example, I want to use attribute based rendering for scale<25000. In this case if the height is deeper than -10, I want a red marker, otherwise I want a green marker.
For map scale>250000, I want a small blue marker.


Thus there need to be 3 rules.





GPS_points




GPS_points
GPS_points


height
-10


100

250000



circle

#cc0123
1.0



3
0




GPS_points
GPS_points



height
-10


100
250000



circle


#11cc99
1.0


3
0





GPS_points
GPS_points
250000



circle

#110cd3

1.0


1
0








No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...