Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Problem with custom SLD style

Hi,

I used <ogc:Function name="Categorize"> instead of if_then_else. Anyway, it crashes in CategorizeFunction.java line 152:

 String lookupValue = lookupExp.evaluate(object, String.class);

Object is null - I debugged it up and finally digged what a object is evaluated. net.refractions.udig.ui.graphics.Glyph.java, line 363.


                d.drawDirect( image, display,
                        d.feature(d.line(new int[]{0,12, 6,3, 11,12, 15,3})),
                        rule );

Line is created for line symbolizer, and as this line is not a feature, it causes side-effects. I also checked that if_then_else comes into problems just in the same place.

Any help would be greatly appreciated.

regards

Lukasz

Cytowanie Jody Garnett <jody.garnett@xxxxxxxxx>:

Please keep discussion on the list (that way I can be corrected by others :-D ).

Sorry for the quick message before; was focused on getting a bug report in. I was not being intentionally opaque - the geotools website is down for me as well.

Looking at the code the functions are:
- CategorizeFunction
- InterpolateFunction
- RecodeFunction

Example docs for the first one:
Implementation of "Categorize" as a normal function.

This implementation is compatible with the Function interface; the parameter list can be used to set the threshold values etc...

This function expects:

PropertyName; use "Rasterdata" to indicate this is a color map
Literal: lookup value
Literal: threshold 1
Literal: value 1
Literal: threshold 2
Literal: value 2
Literal: (Optional) succeeding or preceding
For more details please look at the Symbology Encoding specification (which provides the definition of these functions and examples.

Best thing to do is look at test cases:
- http://svn.osgeo.org/geotools/trunk/modules/library/render/src/test/java/org/geotools/filter/

Here is an example from the test cases:

        final String[] categories = {"low", "mid", "high", "super"};
        final Double[] thresholds = {0.0, 50.0, 100.0};
        setupParameters(categories, thresholds);

        Function fn = finder.findFunction("categorize", parameters);

Cheers,
Jody


On 05/08/2010, at 7:00 PM, Lukasz Stawicki wrote:

Jody,

I know I can use more <sld:Rule...> entries instead of using <ogc:Function name="if_then_else"> but this will make my SLD file 10 times longer (and unable to maintain it). What are the other options for managing colors?

regards

Lukasz


Cytowanie Jody Garnett <jody.garnett@xxxxxxxxx>:

The GeoTools website was hacked last month; I think the DNS is being updated now to point to a new server.

As for your example; you are doing a lot of work to map colours? There is a couple of color lookup functions available now
which should make it easier.

I have reported your issue here:
- https://jira.codehaus.org/browse/GEOT-3234

On 05/08/2010, at 4:14 PM, Lukasz Stawicki wrote:


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)












Back to the top