Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: UDIG 1.2.0
-
Fix Version/s: UDIG 1.2.0
-
Component/s: visualization using map layer and style
-
Labels:None
Description
One of the joys of getting uDig 1.2 near completion is people updating code from GeoTools 2.2 all the way to GeoTools 2.6.
From email here is a regression in the styling system
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter name="stroke">
<ogc:Function name="if_then_else">
<ogc:Function name="lessThan">
<ogc:PropertyName>VOLTAGE_ID</ogc:PropertyName>
<ogc:Literal>3</ogc:Literal>
</ogc:Function>
<ogc:Literal>#FFBB55</ogc:Literal>
<ogc:Function name="if_then_else">
<ogc:Function name="lessThan">
<ogc:PropertyName>VOLTAGE_ID</ogc:PropertyName>
<ogc:Literal>7</ogc:Literal>
</ogc:Function>
<ogc:Literal>#F78484</ogc:Literal>
<ogc:Literal>#5C993C</ogc:Literal>
</ogc:Function>
</ogc:Function>
Producing:
java.lang.IllegalArgumentException: Filter Function problem for function if_then_else argument #0 - expected type boolean
at org.geotools.filter.function.FilterFunction_if_then_else.evaluate(FilterFunction_if_then_else.java:45)
at org.geotools.filter.expression.ExpressionAbstract.evaluate(ExpressionAbstract.java:63)
at org.geotools.styling.SLD.color(SLD.java:1312)
at org.geotools.styling.SLD.color(SLD.java:96)
at org.geotools.styling.SLD.lineColor(SLD.java:84)
at org.geotools.styling.SLD.color(SLD.java:188)
at net.refractions.udig.ui.Drawing.paint(Drawing.java:308)
at net.refractions.udig.ui.Drawing.drawFeature(Drawing.java:246)
at net.refractions.udig.ui.Drawing.drawFeature(Drawing.java:223)
at net.refractions.udig.ui.Drawing.drawDirect(Drawing.java:150)
at net.refractions.udig.ui.graphics.Glyph$6.getImageData(Glyph.java:363)
Thanks to Lukasz for the report.
Here is a style that can be used with countries.shp
<?xml version="1.0" encoding="UTF-8"?> <sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" version="1.0.0"> <sld:UserLayer> <sld:LayerFeatureConstraints> <sld:FeatureTypeConstraint/> </sld:LayerFeatureConstraints> <sld:UserStyle> <sld:Name>Default Styler</sld:Name> <sld:Title/> <sld:IsDefault>1</sld:IsDefault> <sld:FeatureTypeStyle> <sld:Name>simple</sld:Name> <sld:FeatureTypeName>Feature</sld:FeatureTypeName> <sld:SemanticTypeIdentifier>generic:geometry</sld:SemanticTypeIdentifier> <sld:SemanticTypeIdentifier>simple</sld:SemanticTypeIdentifier> <sld:Rule> <sld:PolygonSymbolizer> <sld:Fill> <sld:CssParameter name="fill"> <ogc:Function name="if_then_else"> <ogc:Function name="equalTo"> <ogc:PropertyName>LANDLOCKED</ogc:PropertyName> <ogc:Literal>Y</ogc:Literal> </ogc:Function> <ogc:Literal>#FFFF00</ogc:Literal> <ogc:Literal>#0000FF</ogc:Literal> </ogc:Function> </sld:CssParameter> <sld:CssParameter name="fill-opacity">0.5</sld:CssParameter> </sld:Fill> </sld:PolygonSymbolizer> </sld:Rule> </sld:FeatureTypeStyle> </sld:UserStyle> </sld:UserLayer> </sld:StyledLayerDescriptor>