[gdal-dev] WFS driver and filtering

Stefan Ziegler stefan.ziegler.de at gmail.com
Sat Jun 7 12:36:21 PDT 2014


Hi Even

Using python:

from osgeo import ogr

driver = ogr.GetDriverByName('WFS')
wfs = driver.Open("WFS:http://www.catais.org/wfs/mopublic?")

out = "/home/stefan/Projekte/GeoPackage/test5.gpkg"
outDriver = ogr.GetDriverByName("GPKG")
outDataSource = outDriver.CreateDataSource(out)

layer = wfs.GetLayerByName('hoheitsgrenzen__hoheitsgrenzpunkt')
layer.SetAttributeFilter("bfsnr = 2601")
outLayer = outDataSource.CopyLayer(layer,'test5')

I see 4 request in the apache log:

1. GetCapabilities
2. DescribeFeatureType
3. GetFeature
4. GetFeature

(3) and (4) are equal except (3) adds
",xsd=/vsimem/tempwfs_0x1e50ad0/file.xsd". But no filter is added, pure
GetFeature request.

regards
Stefan



On Sat, Jun 7, 2014 at 8:56 PM, Even Rouault <even.rouault at mines-paris.org>
wrote:

> Le samedi 07 juin 2014 20:46:51, Stefan Ziegler a écrit :
> > Hi
> >
> > I have a question regarding client/server sided filtering. According to
> the
> > wfs driver website [1] the driver is able to forward spatial and
> attribute
> > filter to the server. If this is not possible it will client-side only
> > filtering. When does the driver "decide" wether it filters client or
> server
> > sided? I assume it reads the GetCapabilites file, right?
> >
> > I do have a wfs server which understands ogc filtering (tested with
> simple
> > GET requests in browser)  but the ogr wfs driver does only client sided
> > filtering. Probably a broken GetCapabilities file...
>
> Stefan,
>
> Well, it should maybe, but generally it assumes that the standard operators
> (>,>=,<,<=,==,NOT,AND,OR) are implement by the server.
>
> The choice between client-side and server-side filtering is based on the
> content of the attribute filter. Some stuff can be turned into OGC Filter
> language, some not (for example if using special OGR field names).
> It maybe also due to a limitation of the current implementation that turn
> the
> SQL into OGC filter
>
> What is your filter ?
>
> >
> > I'm using gdal/ogr 1.11.
> >
> > [1]: http://www.gdal.org/drv_wfs.html
> >
> >
> > best regards
> > Stefan
>
> --
> Geospatial professional services
> http://even.rouault.free.fr/services.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140607/fbb4548c/attachment.html>


More information about the gdal-dev mailing list