我遇到了GeoServer SLD XML的问题。
我的XML代码如下:
ERROR [geotools.rendering] - Filter Function problem for function if_then_else argument #2 - expected type Object
我的意图如下:
但是,当应用上述XML时,会发生以下错误。
{{1}}
这里,参数#2是函数Interpolate。 (根据geotools源代码,参数计数从0开始。)似乎Interpolate函数的返回值不是对象。
这是故意的吗?或者我做错了什么?答案 0 :(得分:0)
这是故意的 - 插入颜色映射的函数如何返回一个对象?您可以使用规则和过滤器来完成您想要做的事情,因此这样的(未经测试的)应该起作用:
<Rule>
<ogc:Filter>
<ogc:PropertyIsNull>
<ogc:PropertyName>LTE_RSRP</ogc:PropertyName>
</ogc:PropertyIsNull>
</ogc:Filter>
<ogc:PolygonSymbolizer>
....
<Fill>
....
</Rule>
<Rule>
<ElseFilter/>
<PolygonSymbolizer>
....
<Fill>
<ogc:Function name="Interpolate">
<ogc:PropertyName>LTE_RSRP</ogc:PropertyName>
<ogc:Literal>-80</ogc:Literal>
<ogc:Literal>#ff0000</ogc:Literal>
<ogc:Literal>-70</ogc:Literal>
<ogc:Literal>#00ff00</ogc:Literal>
<ogc:Literal>-60</ogc:Literal>
<ogc:Literal>#0000ff</ogc:Literal>
<ogc:Literal>color</ogc:Literal>
</ogc:Function>
....