There isn't enough of the stack trace provided but this commit is a possible 
source of the regression (GeoServer 2.23.3+): 
https://github.com/geotools/geotools/commit/d7991fdcd1630ea1c18b5dfad91d4e291b8bb95b

Steve Ikeoka
________________________________
From: Jody Garnett <jody.garn...@gmail.com>
Sent: Monday, June 17, 2024 10:17 AM
To: Carsten Klein <c.kl...@datagis.com>
Cc: GeoServer Mailing List List <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Error using function Interpolate in COLOR mode 
from SLD

It is more that I am not aware of any change that could cause this regression. 
Were you able to determine when the problem was introduced and report the issue 
to the issue tracker? I am curious to what you will find. Determing which 
release
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
Please use caution with links, attachments, and any requests for credentials.

ZjQcmQRYFpfptBannerEnd
It is more that I am not aware of any change that could cause this regression.

Were you able to determine when the problem was introduced and report the issue 
to the issue tracker?

I am curious to what you will find. Determing which release the problem started 
in will help a great deal.
--
Jody Garnett


On Jun 13, 2024 at 8:07:09 AM, Carsten Klein 
<c.kl...@datagis.com<mailto:c.kl...@datagis.com>> wrote:

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<https://urldefense.us/v3/__https://github.com/geotools/geotools/blob/f0c9961dc4d40c5acfce2169fab92805738de5ea/modules/library/main/src/main/java/org/geotools/filter/function/InterpolateFunction.java*L320__;Iw!!JRQnnSFuzw7wjAKq6ti6!xut7MRht1ecLGteZ1aKGg5roShoUSjG5tqvW0u3NMBIcQXEZEhSwHmbskJ-MFnqjKx-G314NqB5naHhV1L1EZOg$>

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<mailto: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<https://urldefense.us/v3/__https://docs.geoserver.org/main/en/user/styling/sld/tipstricks/transformation-func.html*id2__;Iw!!JRQnnSFuzw7wjAKq6ti6!xut7MRht1ecLGteZ1aKGg5roShoUSjG5tqvW0u3NMBIcQXEZEhSwHmbskJ-MFnqjKx-G314NqB5naHhVtIy64QA$>

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#/<https://urldefense.us/v3/__http://www.ianturton.com/talks/foss4g.html*/__;Iw!!JRQnnSFuzw7wjAKq6ti6!xut7MRht1ecLGteZ1aKGg5roShoUSjG5tqvW0u3NMBIcQXEZEhSwHmbskJ-MFnqjKx-G314NqB5naHhV9QvXDxc$>
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html<https://urldefense.us/v3/__http://geoserver.org/comm/userlist-guidelines.html__;!!JRQnnSFuzw7wjAKq6ti6!xut7MRht1ecLGteZ1aKGg5roShoUSjG5tqvW0u3NMBIcQXEZEhSwHmbskJ-MFnqjKx-G314NqB5naHhVNukDhRI$>

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<https://urldefense.us/v3/__https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer__;!!JRQnnSFuzw7wjAKq6ti6!xut7MRht1ecLGteZ1aKGg5roShoUSjG5tqvW0u3NMBIcQXEZEhSwHmbskJ-MFnqjKx-G314NqB5naHhVicMCAv4$>


Geoserver-users@lists.sourceforge.net<mailto:Geoserver-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geoserver-users<https://urldefense.us/v3/__https://lists.sourceforge.net/lists/listinfo/geoserver-users__;!!JRQnnSFuzw7wjAKq6ti6!xut7MRht1ecLGteZ1aKGg5roShoUSjG5tqvW0u3NMBIcQXEZEhSwHmbskJ-MFnqjKx-G314NqB5naHhVwRZUp1Q$>
_______________________________________________
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