Hi Jody,

why a puzzle? I've just checked this: The error is reproducible with the latest GeoServer main branch, by simply adding an Interpolate filter function in color mode to one of the standard SLD styles (e.g. simple_roads) in standard data directory.

Making CSSParameter stroke depend on wms_scale_denominator:

<Stroke>
    <CssParameter name="stroke">
        <ogc:Literal>#AA3333</ogc:Literal>
        <ogc:Function name="Interpolate">
            <ogc:Function name="env">
<ogc:Literal>wms_scale_denominator</ogc:Literal>
            </ogc:Function>
            <ogc:Literal>2132</ogc:Literal>
            <ogc:Literal>#AA3333</ogc:Literal>
            <ogc:Literal>17471320</ogc:Literal>
            <ogc:Literal>#AA9999</ogc:Literal>
            <ogc:Literal>color</ogc:Literal>
        </ogc:Function>
    </CssParameter>
    <CssParameter name="stroke-width">
        <ogc:Literal>2</ogc:Literal>
    </CssParameter>
</Stroke>

leads to exception:

[...]
Caused by: java.lang.IllegalArgumentException: Trying to evaluate the function as Object but the method parameter is set as COLOR     at org.geotools.filter.function.InterpolateFunction.evaluate(InterpolateFunction.java:323)     at org.geotools.filter.function.InterpolateFunction.evaluate(InterpolateFunction.java:301)     at org.geotools.filter.visitor.SimplifyingFilterVisitor.visit(SimplifyingFilterVisitor.java:484)     at org.geotools.filter.function.InterpolateFunction.accept(InterpolateFunction.java:296)     at org.geotools.styling.visitor.DuplicatingStyleVisitor.copy(DuplicatingStyleVisitor.java:379)     at org.geotools.styling.visitor.DuplicatingStyleVisitor.visit(DuplicatingStyleVisitor.java:655)
    at org.geotools.styling.StrokeImpl.accept(StrokeImpl.java:420)
    [....]

thrown here:

https://github.com/geotools/geotools/blob/f0c9961dc4d40c5acfce2169fab92805738de5ea/modules/library/main/src/main/java/org/geotools/filter/function/InterpolateFunction.java#L320

Seems like /Class<T> context/ does not implement /Color/ It works fine if method is "numeric" (in contrast to "color").

Carsten


Am 10.06.2024 um 20:55 schrieb Jody Garnett:
H there x 2,

That is quite a puzzle.

It may be a case of:

 1. Trying to reproduce the error with the standard data directory and
    making a bug report
 2. Trying the different version between 2.22.2 and 2.25.1 to see when
    it breaks (and then we could learn more)
    If doing this approach it is best to bisect debugging approach:
    take a version in the middle, and then you know to test higher or
    lower.  Take in the middle of the new range etc...


--
Jody Garnett


On Jun 9, 2024 at 11:59:07 PM, Carsten Klein <c.kl...@datagis.com> wrote:

Hi there,

I've updated one of our GeoServes from version 2.22.2 to latest stable 2.25.1. When requesting SLD-styled maps via WMS I'm getting this OWS exception:

Error rendering layer mga.bl: Trying to evaluate the function as Object but the method parameter is set as COLOR

I guess, it's about the Interpolate function, which we use to vary line colors depending on wms_scale_denominator:

    <Fill>
        <CssParameter name="fill">
            <ogc:Function name="Interpolate">
                <ogc:Function name="env">
<ogc:Literal>wms_scale_denominator</ogc:Literal>
                </ogc:Function>
<ogc:Literal>2132</ogc:Literal>
<ogc:Literal>#202020</ogc:Literal>
<ogc:Literal>17471320</ogc:Literal>
<ogc:Literal>#404040</ogc:Literal>
<ogc:Literal>color</ogc:Literal>
            </ogc:Function>
        </CssParameter>
    </Fill>

There's no longer any error after removing that function from SLDs.

The styles have not been changed. These used to work well with the 2.22.2 version.

I haven't found any breaking changes in the documentation for filter function Interpolate. Actually, my SLD seems quite identical to what the documentation shows:

https://docs.geoserver.org/main/en/user/styling/sld/tipstricks/transformation-func.html#id2

Any help and ideas are very appreciated.

Cheers
Carsten

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list: - Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/ - The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


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

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to