Hi Andrea,

[...]
>> cqlStr = "if_then_else(cat % 2 == 0, true, false)"
>> Filter cqlFilter = CQL.toFilter(cqlStr);
>>
>> new Fc = fc.subCollection(cqlFilter);
>
> My guess is, there is % operator in the OGC filter specification,
> so the above cannot be properly translated.
>
> I guess you have to introduce first a FilterFunction_modulus
> that computes the rest of the division and then you can
> do something like
>
> modulus(cat, 2) = 0

There is:
IEEEremainder( dividend, divisor )

which sounds like the one that can be used?

IEEEremainder( cat, 2.0 ) = 0

But I only get:
org.geotools.filter.text.cql2.CQLException: Encountered "=" at line 1,
column 27.
Was expecting one of:
    <EOF>
    <AND> ...
    "or" ...
    . Parsing : IEEEremainder( cat, 2.0 ) = 0. Current Token : ")"
...

> (no need for if_then_else)
>
> Alternatively, and without introducing a new function, this
> should work too:
>
> cat - floor((cat / 2)) * 2 = 0

Yeah, that looks nice, I tried it and:

org.geotools.filter.text.cql2.CQLException: Encountered "-" at line 1, column 5.
Was expecting one of:
    "(" ...
    ":" ...
    <IDENTIFIER> ...
    "." ...
    <NOT> ...
    "like" ...
    "is" ...
    "exists" ...
    "does-not-exist" ...
    "before" ...
    "after" ...
    "during" ...
    "between" ...
    <EQ> ...
    <GT> ...
    <LT> ...
    <GTE> ...
    <LTE> ...
    <NEQ> ...
    . Parsing : cat - floor((cat / 2)) * 2 = 0. Current Token : "cat"
...


So I wonder if I am doing something odd...

Thanks,
Andrea





>
> Cheers
> Andrea
>
>
> --
> Andrea Aime
> OpenGeo - http://opengeo.org
> Expert service straight from the developers.
>

------------------------------------------------------------------------------
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to