Is it possible to use simple Math in an SLD file on Geoserver? Suppose I want to read a text size property from a database and multiply its value, how can I do this?
...
text_size * 2.1
...
This simple approach obviously doesn't work, so I thought there must be some way to achieve this.
Answer
You can use the math functions ogc:Mul ogc:Div ogc:Add & ogc:Sub to do simple maths on properties.
So your example would become:
text_size
2.5
The only issue is that technically the SLD specification may not allow you to use a function in a CssParameter. However GeoServer is much more forgiving and will allow it.
If you ever need more complex functions see the reference page.
No comments:
Post a Comment