-----Message d'origine-----
De : [email protected] [mailto:[email protected]] De la part de Andrea 
Aime
Envoyé : Tuesday, November 23, 2010 10:57 AM
À : Jeremy HANOUN
Cc : [email protected]
Objet : Re: [Geoserver-users] How to add a function

On Tue, Nov 23, 2010 at 8:56 AM, Jeremy HANOUN
<[email protected]> wrote:
> Guys,
>
>
>
> I may need your help on the following point.
>
>
>
> I need to add a function to apply on Geometry and wanted to know if this is
> doable as a plugin.

It is

> If so, I'll be very pleased to have some information on how to do that.

We don't have a guide but adding a function is easy enough that you can just
see how it's done and replicate.

Look at the GeoTools main module:
http://svn.osgeo.org/geotools/trunk/modules/library/main/src/
this is where most of the function code is:
http://svn.osgeo.org/geotools/trunk/modules/library/main/src/main/java/org/geotools/filter/function/
this is a simple date formatting function:
http://svn.osgeo.org/geotools/trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_dateFormat.java

To have them plug into GeoTools/GeoServer you also need to add a file
in META-INF declaring the existance of the function,
like this one:
http://svn.osgeo.org/geotools/trunk/modules/library/main/src/main/resources/META-INF/services/org.opengis.filter.expression.Function

Hi Andrea,

Thanks for the answer.

I think that i've missed something...
I made a new project with the code for a class named FilterFunction_padding 
that extends FunctionExpressionImpl. The aim is to transform some geometries a 
little.
My tree looks like :
/src
    /perso
        /plugin
            /filter
                /function
                    FilterFunction_padding.java
    /META-INF
        org.opengis.filter.expression.Function

Inside the file org.opengis.filter.expression.Function I have the following 
line without quotes
'perso.plugin.filter.function.FilterFunction_padding' and a '\n' at the end of 
the line.

I run GeoServer under Linux from the source and added a reference to this 
project on web-app, but I still get the following error : 

23 nov. 13:48:16 ERROR [geoserver.ows] - 
java.lang.RuntimeException: Unable to find function Padding
        at 
org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:177)
        at 
org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:74)
        at 
org.geotools.filter.FilterFactoryImpl.function(FilterFactoryImpl.java:468)
        at 
org.geotools.filter.ExpressionDOMParser.expression(ExpressionDOMParser.java:394)
        at 
org.geotools.filter.ExpressionDOMParser.parseExpression(ExpressionDOMParser.java:102)

After that, I also tried to add the reference on ows without success.

Do you see what I missed ?

Best Regards,

-- 
Jeremy Hanoun


------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to