Skip to content
Permalink
Browse files

[BUGFIX][QGIS Server] No flags in QgsFeatureRequest if expression nee…

…ds geometry
  • Loading branch information
rldhont committed Nov 3, 2016
1 parent 8b3c39a commit 74f49ddd197ad05182f9e7ce59213663297f498e
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/server/qgswfsserver.cpp
@@ -656,7 +656,14 @@ int QgsWfsServer::getFeature( QgsRequestHandler& request, const QString& format
throw QgsMapServiceException( QStringLiteral( "RequestNotWellFormed" ), filter->parserErrorString() );
}
QgsFeatureRequest req;
req.setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) );
if ( filter->needsGeometry() )
{
req.setFlags( QgsFeatureRequest::NoFlags );
}
else
{
req.setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) );
}
req.setFilterExpression( filter->expression() );
#ifdef HAVE_SERVER_PYTHON_PLUGINS
mAccessControl->filterFeatures( layer, req );

3 comments on commit 74f49dd

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied Nov 3, 2016

@rldhont which provider did you encounter this with? Imho it should be fixed in the provider itself - eg: https://github.com/qgis/QGIS/blob/master/src/providers/postgres/qgspostgresfeatureiterator.cpp#L101

I could have sworn I added a provider suite test covering this, but I must be mistaken...

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied Nov 4, 2016

Actually I just double checked and it is - see https://github.com/qgis/QGIS/blob/master/tests/src/python/providertestbase.py#L100 and https://github.com/qgis/QGIS/blob/master/tests/src/python/providertestbase.py#L200

So this case should already be handled in core/providers. Can you provide more details as to how you experienced this issue?

@rldhont

This comment has been minimized.

Copy link
Contributor Author

@rldhont rldhont replied Nov 4, 2016

Hi @nyalldawson, here is the expression:

intersects($geometry, geom_from_gml('<gml:Polygon xmlns:gml="http://www.opengis.net/gml"><gml:outerBoundaryIs xmlns:gml="http://www.opengis.net/gml"><gml:LinearRing xmlns:gml="http://www.opengis.net/gml"><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">437341.8357397162,5406708.150074777 435774.8766600882,5406134.872362718 436806.7765417944,5405102.972481012 437341.8357397162,5406708.150074777</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>'))

it comes from this OGC Filter:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <wfs:Query typeName="qgs:SousQuartiers" xmlns:qgs="http://www.qgis.org/gml">
    <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
      <ogc:Intersects>
        <ogc:PropertyName>GEOMETRY</ogc:PropertyName>
        <gml:Polygon xmlns:gml="http://www.opengis.net/gml"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates decimal="." cs="," ts=" ">437341.8357397162,5406708.150074777 435774.8766600882,5406134.872362718 436806.7765417944,5405102.972481012 437341.8357397162,5406708.150074777</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>
      </ogc:Intersects>
    </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

It failed on ESRI Shapefile and successed on Spatialite with version 2.14

Please sign in to comment.
You can’t perform that action at this time.