Hi Nenad,
OK, here's where I try to sell you another filter function hack and
see if Miles can trump it with a one liner again :-)
import java.util.HashMap;
import java.util.Map;
import org.geotools.filter.FunctionExpressionImpl;
import org.opengis.feature.simple.SimpleFeature;
public class VarLookupFunction extends FunctionExpressionImpl {
private static Map<String, Double> table
public VarLookupFunction(String name) {
super("VarLookup");
}
public static void setLookupValues(Map<String, Double> values) {
table = new HashMap<String, Double>();
table.putAll(values);
}
@Override
public int getArgCount() {
return 1;
}
@Override
public Object evaluate(SimpleFeature feature) {
String varName = getExpression(0).evaluate(feature, String.class);
return lookupValues.get(varName);
}
}
Before rendering, populate the lookup table...
VarLookup.setLookupValues( someHashMapOfValues );
In your SLD file...
<FeatureTypeStyle>
<Rule>
<Filter>
<PropertyIsEqualTo>
<PropertyName>foo</PropertyName>
<Function name="VarLookup">
<Literal>variableName</Literal>
</Function>
</PropertyIsEqualTo>
</Filter>
Warning - I haven't tested this and don't really know anything about SLD.
Michael
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users