On Tue, 17 Sep 2019 at 16:00, Schulze, Matthias (LDBV) <
matthias.schu...@ldbv.bayern.de> wrote:

> Hello geotools community,
>
>
>
>
>
> maybe I discovered another bug in the wfs implementation of geotools. Or I
> just can not configure everything correctly
>
>
>
>
>
> I want to get a feature from a wfs server with wfs 2.0 (Web Feature
> Service 2.0. (ISO 19142)) and fes 2.0 (Filter Encoding Standard (FES) 2.0
> (ISO 19143)). But geotools looks in the fes 2.0 conform capabilities
> (PropertyIsEqualTo) for a ogc filtername (EqualTo). So geotools thinks, the
> server does not support the requested filter.
>
>
>
> The question is, is it already possible to use wfs 2.0 with fes 2.0 in
> geotools? Or is a special configuration needed, which I forgot?
>
>
>
>
>
> Here is a code example:
>
>
>
> *final* ContentFeatureSource source = …
>
> *final* Filter filter = CQL.*toFilter*("ags = '09162000'", *null*);
>
> final FeatureReader<SimpleFeatureType, SimpleFeature> features = source
> .getReader(filter);
>
>
>
> Geotools thinks, this filter is not supported from the wfs server. So
> geotools just grabs all the features from the Server L And than makes the
> filtering itself. This is the problem, because the Server should to do the
> filtering itself.
>
>
>
>
>
> The details of the problematic code:
>
>
>
> The created filter from the statement above is
> org.geotools.filter.IsEqualsToImpl.
>
>
>
> The code which desides if the filter is supported or unsupported is in
> class org.geotools.data.wfs.internal.v2_0.StrictWFS_2_0_Strategy in method
> createGetFeatureRequestPost.
>
>
>
> The splitting between supported filters and unsupported filters is made in
> class org.geotools.filter.visitor.CapabilitiesFilterSplitter in method
> visitBinaryOperator.
>
>
>
> The comparising happens in class
> org.geotools.filter.visitor.IsSupportedFilterVisitor:
>
>     public Object visit( PropertyIsEqualTo filter, Object extraData ) {
>
>         ScalarCapabilities scalar = capabilities.getScalarCapabilities();
>
>         if( scalar == null ) return false;
>
>
>
>         ComparisonOperators operators = scalar.getComparisonOperators();
>
>         if( operators == null ) return false;
>
>
>
>         return operators.getOperator( PropertyIsEqualTo.NAME ) != null;
>
>     }
>

That does look like a bug, it should probably use filter.NAME not the
constant. But beware there are issues with the way all the datastores based
on contentstore handle supported filters that I added some code in wfs-ng
to avoid a few months ago.

I would go ahead and create an issue and a PR with test and I (or some
other volunteer) will try and review it when I get a spare moment.

Ian
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to