Agreed with Jody, should be a new set of functions, you can delegate to the
old one if needed (but not fully, the
Name returned cannot be the same). Should be doable with just a factory and
a generic function wrapper instanciated
with the target function and the new name to be used... as long as the
semantic of the function is the same
(I'd expect it to be, but wouldn't just assume it).

What is worrying me a bit is, to what point do you want to push this?
Having them in CQL is fine. Having a 1-1 translation
down in SQL, done in FilterToSQL, the class shared by all databases, is
not: some databases would not natively support
the functions anyways. Examples are GeoTools own H2 store, Oracle with
Locator extension (afaik), GeoPackage.
So, the eventual encoding down in SQL should be left to a case by case
decision.

Cheers
Andrea

On Wed, Dec 23, 2020 at 3:41 AM Jody Garnett <jody.garn...@gmail.com> wrote:

> Yep, that is just the only reference we have mapping from SFSQL to
> geotools functions right now.
>
> And yeah, you should be able to extend not geotools function, but geotools
> function factory.
>
> 1. Make a new FunctionFactory listing the SFSQL function names
> 2. Make a Function wrapper implementation
> 3. Use the wrapper to create any SFSQL function name instance requested
>
> --
> Jody Garnett
>
>
> On Tue, 22 Dec 2020 at 08:42, Erwan Bocher <erwan.boc...@univ-ubs.fr>
> wrote:
>
>> Jody,
>>
>> I know that but I want to use the SFS function names in ECQL.
>>
>> If I understand well the way to do that is to extend the current geotools
>> function and filter on my side and register them ?
>>
>> Erwan
>> Le 22/12/2020 à 08:47, Jody Garnett a écrit :
>>
>> Erwan:
>>
>> It depends a bit on each database, you will find that many of them
>> implement the SFSQL specification.
>>
>> Here is one for PostGIS:
>> https://github.com/geotools/geotools/blob/master/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/FilterToSqlHelper.java
>>
>>
>>
>> --
>> Jody Garnett
>>
>>
>> On Mon, 7 Dec 2020 at 07:50, Erwan Bocher <erwan.boc...@univ-ubs.fr>
>> wrote:
>>
>>> Hi,
>>>
>>> I have a first prototype to convert SQL expression to Geotools
>>> Expression available as a draft here
>>> https://github.com/orbisgis/orbisgis/pull/1404
>>>
>>> Spatial databases use ST_ prefix to define spatial function. e.g
>>> st_area, st_centroid
>>>
>>> Geotools expression and filter function doesn't.
>>>
>>> I added a workaround in the sql to expression parser to check when the
>>> sql expression contains a "st_" function and rename it to a geotools
>>> representation.
>>>
>>> I'd like to known if there is a simple way to aliasing filter function
>>> in geotools and write something like that
>>>
>>> st_area(the_geom) >1000 instead of area(the_geom) >1000
>>>
>>> best regards
>>>
>>> Erwan
>>>
>>> --
>>> Ingénieur de Recherche CNRS - HDR,
>>> Laboratoire Lab-STICC – UMR 6285
>>> Equipe DECIDE
>>> Institut Universitaire de Technologie de Vannes
>>> 8, Rue Montaigne - BP 561 56017 Vannes Cedex
>>> T: +33 2 97 62 64 92
>>> W: https://cv.archives-ouvertes.fr/erwan-bocher
>>> W: http://www.labsticc.fr
>>>
>>>
>>>
>>> _______________________________________________
>>> GeoTools-GT2-Users mailing list
>>> GeoTools-GT2-Users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>
>> --
>> Ingénieur de Recherche CNRS - HDR,
>> Laboratoire Lab-STICC – UMR 6285
>> Equipe DECIDE
>> Institut Universitaire de Technologie de Vannes
>> 8, Rue Montaigne - BP 561 56017 Vannes Cedex
>> T: +33 2 97 62 64 92
>> W: https://cv.archives-ouvertes.fr/erwan-bocher
>> W: http://www.labsticc.fr
>>
>> _______________________________________________
>> GeoTools-GT2-Users mailing list
>> GeoTools-GT2-Users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>


-- 

Regards, Andrea Aime

== GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf
Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa
(LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549
http://www.geo-solutions.it http://twitter.com/geosolutions_it
------------------------------------------------------- *Con riferimento
alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 -
Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni
circostanza inerente alla presente email (il suo contenuto, gli eventuali
allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i
destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per
errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le
sarei comunque grato se potesse darmene notizia. This email is intended
only for the person or entity to which it is addressed and may contain
information that is privileged, confidential or otherwise protected from
disclosure. We remind that - as provided by European Regulation 2016/679
“GDPR” - copying, dissemination or use of this e-mail or the information
herein by anyone other than the intended recipient is prohibited. If you
have received this email by mistake, please notify us immediately by
telephone or e-mail.*
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to