Hi Rob,

2014-02-06 9:22 GMT+01:00 Rob van Swol <rob.van.s...@nlr.nl>:

>  Hi,
>
> I am using geotools 10.4 en I am trying to encode a FES filter to XML. (I
> never had any problems with v1.1 OGC Filters). For example: encoding a
> PropertyIsLike filter results in (ValueReference and Literal are missong):
> <fes:Filter 
> xmlns:fes="http://www.opengis.net/fes/2.0";<http://www.opengis.net/fes/2.0>xmlns:gml=
> "http://www.opengis.net/gml/3.2"; <http://www.opengis.net/gml/3.2>>
>    <fes:PropertyIsLike escapeChar="\" singleChar="?" wildCard="*"/>
> </fes:Filter>
>
>  [created using :
> FilterFactory ff = CommonFactoryFinder.getFilterFactory2();
> PropertyIsLikef = ff.like(ff.property("name"), "%piet%");
> Configuration configuration = new
> org.geotools.filter.v2_0.FESConfiguration();
> Encoder encoder = new org.geotools.xml.Encoder(configuration);
> encoder.encode(filter, org.geotools.filter.v2_0.FES.Filter, os);
> etc:]
>

I tried to replicate your issue, and in effect it seems that there is a bug
in the 2.0 filters encoding.

Is this the expected result?

<?xml version="1.0" encoding="UTF-8"?>
<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0"; xmlns:gml="
http://www.opengis.net/gml/3.2";>
    <fes:PropertyIsLike escapeChar="\" singleChar="?" wildCard="*">
        <fes:ValueReference>name</fes:ValueReference>
        <fes:Literal>%piet%</fes:Literal>
    </fes:PropertyIsLike>
</fes:Filter>

If you can confirm I will submit a patch to solve this issue.


>
> Creating an AFTER filter (from an XML input) just results in:
> <fes:Filter 
> xmlns:fes="http://www.opengis.net/fes/2.0";<http://www.opengis.net/fes/2.0>xmlns:gml=
> "http://www.opengis.net/gml/3.2"; <http://www.opengis.net/gml/3.2>/>
>
> However, surrounding this AFTER with <fes:And> gives the expected result:
> <fes:Filter 
> xmlns:fes="http://www.opengis.net/fes/2.0";<http://www.opengis.net/fes/2.0>xmlns:gml=
> "http://www.opengis.net/gml/3.2"; <http://www.opengis.net/gml/3.2>>
>    <fes:And>
>       <fes:After>
>          <fes:ValueReference>date</fes:ValueReference>
>          <fes:Literal>1970-01-01T00:00:00Z</fes:Literal>
>       </fes:After>
>    </fes:And>
> </fes:Filter>
>

Another bug, I'm afraid.
Tried the following snippet:

        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
        Filter filter = ff.after(ff.property("date"), ff.literal(new
Date()));
        org.geotools.filter.v2_0.FESConfiguration configuration = new
org.geotools.filter.v2_0.FESConfiguration();
        org.geotools.xml.Encoder encoder = new
org.geotools.xml.Encoder(configuration);
        encoder.encode(filter, org.geotools.filter.v2_0.FES.Filter, os);

I have a patch for this too, so going to submit a JIRA and a patch.

Do you have any other 2.0 filter encoding issues?

Mauro


-- 
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==

Dott. Mauro Bartolomeoli
@mauro_bart
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to