Unable to find custom function "Colourmap"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Unable to find custom function "Colourmap"

Trupti Pol
This post has NOT been accepted by the mailing list yet.
Hi,

I am trying to develope a custom function "ColorMap" which can be used in SLD to get the different style based on feature attributes.

This function is mainly utilized to provide different draw color to each feature based on the "ColorIndex" attribute.

My Sample function is as follows

public class ColorMapFunction extends FunctionExpressionImpl{

        public ColorMapFunction(String name) {
                super("ColorMap");
        }

        @Override
        public int getArgCount() {
                return 1;
        }

        public Object evaluate(Object feature) {
                String colorIndex;
     

                try {
              colorIndex = getExpression(0).evaluate(feature).toString();
        } catch (Exception e){ // probably a type error
                      throw new IllegalArgumentException(
                          "Filter Function problem for function ColorMap argument #0 - expected type String");
               }

               return getColor(colorIndex);
               }
       
           private String getColor(String colorTablePath, String colorIndex){
                // will provide different color based on colorIndex
           }
}

But when i try to use this function in my .sld file it gives me error as below

Unable to find function Colourmap
> java.lang.RuntimeException: Unable to find function Colourmap
>     at
> org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:103)
>     at
> org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:69)
>     at
> org.geotools.filter.FilterFactoryImpl.function(FilterFactoryImpl.java:469)


Please let me know am i skipping something here..I am using geotools 2.6 M2 version
Loading...