Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Unable to find custom function "Colourmap"

use geotools 8 and try it

On 29 June 2012 18:09, Trupti Pol <ktrup7@xxxxxxxxx> wrote:
> 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
>
> --
> View this message in context: http://gis.19327.n5.nabble.com/Unable-to-find-custom-function-Colourmap-tp5714582.html
> Sent from the uDig Developer mailing list archive at Nabble.com.
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel



-- 
Regards,
B Kranthi Kumar,
Project Engineer,
C-DAC (R & D)-Pune-411007.


Back to the top