Skip to content

Commit

Permalink
ogr provider fix: apparently we need to fetch the geometry to make th…
Browse files Browse the repository at this point in the history
…e spatial filter stick.
  • Loading branch information
jef-n committed Jul 18, 2011
1 parent 30708cb commit 40cabbd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -518,7 +518,8 @@ bool QgsOgrProvider::nextFeature( QgsFeature& feature )
OGRFeatureH fet;
QgsRectangle selectionRect;

setRelevantFields( mFetchGeom || mUseIntersect, mAttributesToFetch );
setRelevantFields( mFetchGeom || mUseIntersect || !mFetchRect.isEmpty(),
mAttributesToFetch );

while (( fet = OGR_L_GetNextFeature( ogrLayer ) ) )
{
Expand Down Expand Up @@ -616,6 +617,7 @@ void QgsOgrProvider::select( QgsAttributeList fetchAttributes, QgsRectangle rect
mUseIntersect = useIntersect;
mAttributesToFetch = fetchAttributes;
mFetchGeom = fetchGeometry;
mFetchRect = rect;

// spatial query to select features
if ( rect.isEmpty() )
Expand Down
3 changes: 3 additions & 0 deletions src/providers/ogr/qgsogrprovider.h
Expand Up @@ -276,6 +276,9 @@ class QgsOgrProvider : public QgsVectorDataProvider
//! layer index
int mLayerIndex;

//! current spatial filter
QgsRectangle mFetchRect;

//! String used to define a subset of the layer
QString mSubsetString;

Expand Down

0 comments on commit 40cabbd

Please sign in to comment.