SLD过滤函数if_then_else参数#2 -期望类型对象



我正在面对GeoServer SLD XML的问题。

我的XML代码如下:
<Fill>
    <CssParameter name="fill">
        <ogc:Function name="if_then_else">
            <ogc:Function name="isNull">
                <ogc:PropertyName>LTE_RSRP</ogc:PropertyName>
            </ogc:Function>
            <ogc:Literal>#FF0000</ogc:Literal>
            <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>
        </ogc:Function>
    </CssParameter>
    <CssParameter name="fill-opacity">0.3</CssParameter>
</Fill>

我的意图如下:

  • 如果LTE_RSRP为空,用#FF0000填充。
  • 否则,插入颜色。

但是当应用上面的XML时,出现以下错误:

ERROR [geotools.rendering] - Filter Function problem for function if_then_else argument #2 - expected type Object

这里,参数#2是函数Interpolate。(根据geotools源代码,参数计数从0开始。)函数Interpolate的返回值似乎不是一个对象。

这是故意的吗?还是我做错了什么?

这是故意的-一个函数如何插入一个颜色映射返回一个对象?你想做的事情可以使用规则和过滤器来完成,所以像这样的东西(未经测试)应该可以工作:

<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>
       ....

最新更新