For a quick fix you can change that to use perimeter(the_geom)>1000 ) =
true and the existing code should work.

Ian

On Wed, 4 Nov 2020 at 16:16, Erwan Bocher <erwan.boc...@univ-ubs.fr> wrote:

> Hi,
> Le 04/11/2020 à 16:51, Andrea Aime a écrit :
>
> Hi,
> yes that looks promising. I don't see the registration of the function in
> META-INF, but I guess that's handled
> in a different commit
>
> here
> https://github.com/ebocher/geotools/blob/addFunctions/modules/library/main/src/main/resources/META-INF/services/org.opengis.filter.expression.Function#L204
>
> Current and , or operators work with left, right operands. I' m facing
> with a new issue if the user wants to do
>
> (type='parcels' and area(the_geom) >=20000 or perimeter(the_geom)>1000 )
> or landuse='grass'
>
> Any idea ?
>
> What about using a list of parameters as input ?
>
> Bests
>
> Erwan
>
>
> Cheers
> Andrea
>
>
> On Wed, Nov 4, 2020 at 4:19 PM Erwan Bocher <erwan.boc...@univ-ubs.fr>
> wrote:
>
>> Hi Andrea,
>>
>> Thanks.
>>
>> Here first implementations :
>> https://github.com/ebocher/geotools/commit/8f5dec5d82967fb91d370bf4408840cbdedf9eca
>>
>> I hope I'm on the right road ;-)
>>
>> Erwan
>> Le 04/11/2020 à 11:49, Andrea Aime a écrit :
>>
>> Hi Erwan,
>> yes, if you want to use expressions, you'll have to replicate every
>> missing bit as a function.
>> As a word of caution, functions are almost always evaluated in memory,
>> unless the particular
>> data store provides direct support for them (the PostGIS datastore has
>> examples for a few string manipulation functions).
>>
>> Cheers
>> Andrea
>>
>> On Wed, Nov 4, 2020 at 10:45 AM Erwan Bocher <erwan.boc...@univ-ubs.fr>
>> wrote:
>>
>>> Hi Jim,
>>>
>>> Logical op works well with Filter but I want to use it to build an
>>> expression.
>>>
>>> @andrea,
>>>
>>> Do we need to add a And function that extends FunctionExpressionImpl ?
>>>
>>> If yes it 'd be the same approach for Or op.
>>>
>>> Best regards
>>>
>>> Erwan
>>>
>>>
>>> Le 02/11/2020 à 19:21, Jim Hughes a écrit :
>>>
>>> Hi Erwan,
>>>
>>> I don't think there's an "and" function.  It can be used between two
>>> conditions[1].
>>>
>>> Cheers,
>>>
>>> Jim
>>>
>>> 1.
>>> https://docs.geoserver.org/stable/en/user/filter/ecql_reference.html#condition
>>> (I end up referring to this page frequently to figure out syntax.)
>>>
>>> 2. I also like this page:
>>> https://docs.geoserver.org/stable/en/user/tutorials/cql/cql_tutorial.html
>>> On 11/2/2020 5:45 AM, Erwan Bocher wrote:
>>>
>>> Based on
>>> https://docs.geotools.org/latest/userguide/library/opengis/filter.html
>>> , I try to use logical op like this
>>>
>>> "if_then_else(and(greaterThan(area(THE_GEOM), 10),equalTo(type, 12)),5, 1)"
>>>
>>> return me
>>>
>>> Exception in thread "main" org.geotools.filter.text.cql2.CQLException: 
>>> Encountered "and" at line 1, column 14.
>>>
>>> Am I doing something wrong?
>>>
>>> Best regards
>>>
>>> Erwan
>>>
>>> Le 02/11/2020 à 10:30, Erwan Bocher a écrit :
>>>
>>>
>>> Le 02/11/2020 à 10:23, Andrea Aime a écrit :
>>>
>>> No, it does not, but you can make it so by modifying FilterToSQL, and
>>> then go around and change
>>> the database filter capabilities (otherwise the filter splitter will
>>> take it out). Well, unless you can ensure
>>> every single database supports CASE WHEN with the same syntax. Which
>>> seems like it may be true
>>> for most, but every time I bet on it, I find a database that does not
>>> follow the SQL standard...):
>>>
>>>
>>> Ok
>>>
>>> I will test this change with the H2GIS-Geotools datastore (
>>> https://github.com/orbisgis/h2gis-geotools) and share my result when it
>>> rocks
>>>
>>> Best regards
>>>
>>>
>>> --
>>> 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 
>>> listGeoTools-GT2-Users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>
>>>
>>>
>>> _______________________________________________
>>> GeoTools-GT2-Users mailing 
>>> listGeoTools-GT2-Users@lists.sourceforge.nethttps://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
>>>
>>
>>
>> --
>>
>> 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.*
>>
>> --
>> 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
>>
>>
>
> --
>
> 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.*
>
> --
> 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
>


-- 
Ian Turton
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to