Skip to content

Commit

Permalink
[BUGFIX][QGIS Server] Apply filter element
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Nov 2, 2016
1 parent fca3dc2 commit d20b2a8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/server/qgswfsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,22 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
{
throw QgsMapServiceException( "RequestNotWellFormed", filter->parserErrorString() );
}
QgsFeatureRequest req;
req.setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) );
req.setFilterExpression( filter->expression() );
#ifdef HAVE_SERVER_PYTHON_PLUGINS
mAccessControl->filterFeatures( layer, req );

QStringList attributes = QStringList();
Q_FOREACH ( int idx, attrIndexes )
{
attributes.append( layer->pendingFields().field( idx ).name() );
}
req.setSubsetOfAttributes(
mAccessControl->layerAttributes( layer, attributes ),
layer->pendingFields() );
#endif
QgsFeatureIterator fit = layer->getFeatures( req );
while ( fit.nextFeature( feature ) && ( !hasFeatureLimit || featureCounter < maxFeatures + startIndex ) )
{
expressionContext.setFeature( feature );
Expand Down

0 comments on commit d20b2a8

Please sign in to comment.