[Geoserver-users] using expressions in SLD CSS parameters?

Hi,

I wonder if it is possible to use expressions in SLD CSS parameters, and
if so, how?

I trying to create a <CssParameter> element, with a calculated value,
for example:

<CssParameter name="stroke-width">500000 * 0.0005</CssParameter>

but I get an error saying:

Caused by: java.lang.IllegalArgumentException: Unable to decode '500000
* 0.0005' as a number
    at org.geotools.filter.Filters.number(Filters.java:534)

I could try using an <ogc:Function name="multiply">...</ogc:Function>,
but there is no OGC function that actually does multiplication (or it
seems any of the basic math functions, add, substract, multiply, divide)

my overall goal is to create stroke width, etc. parameters which are
calculated based on the scale of the rendering, and I'd like to
implement this by basing these values on basic calculcations of the
wms_scale_denominator env attribute defined by GeoServer

Akos

See the section on expressions in the manual: http://docs.geoserver.org/latest/en/user/styling/sld-reference/filters.html#filter-expressions

···

On Mon, Dec 17, 2012 at 9:32 AM, Ákos Maróy <akos@anonymised.com> wrote:

Hi,

I wonder if it is possible to use expressions in SLD CSS parameters, and
if so, how?

I trying to create a element, with a calculated value,
for example:

500000 * 0.0005

but I get an error saying:

Caused by: java.lang.IllegalArgumentException: Unable to decode '500000

  • 0.0005’ as a number
    at org.geotools.filter.Filters.number(Filters.java:534)

I could try using an <ogc:Function name=“multiply”>…</ogc:Function>,
but there is no OGC function that actually does multiplication (or it
seems any of the basic math functions, add, substract, multiply, divide)

my overall goal is to create stroke width, etc. parameters which are
calculated based on the scale of the rendering, and I’d like to
implement this by basing these values on basic calculcations of the
wms_scale_denominator env attribute defined by GeoServer

Akos


LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

On 17/12/12 15:35, David Winslow wrote:

See the section on expressions in the
manual: http://docs.geoserver.org/latest/en/user/styling/sld-reference/filters.html#filter-expressions

thanks, I missed this one!