Skip to content

Commit

Permalink
[BUGFIX][QGIS Server] No flags in QgsFeatureRequest if expression nee…
Browse files Browse the repository at this point in the history
…ds geometry
  • Loading branch information
rldhont committed Nov 3, 2016
1 parent 8b3c39a commit 74f49dd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/server/qgswfsserver.cpp
Expand Up @@ -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 );
Expand Down

3 comments on commit 74f49dd

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor Author

@rldhont rldhont commented on 74f49dd Nov 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.