[gdal-dev] WFS driver and filtering

Even Rouault even.rouault at mines-paris.org
Sat Jun 7 12:50:31 PDT 2014


Le samedi 07 juin 2014 21:36:21, Stefan Ziegler a écrit :
> 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.

Actually I was wrong. Cannot even remember my own code from 4 years ago ;-)
It does check that GetCapabilities reports LogicalOperators or 
Logical_Operators, which your server does not.
Strictly speaking your request doesn't require LogicalOperators, so that could 
be improved of course to be less restrictive...
But that must be an antiquitated implementation of WFS: only 1.0.0 and no 
logical operators... ?

> 
> 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

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list