Skip to content
Permalink
Browse files

Fix zonal stats not saving values to spatialite layers (fix #11849)

  • Loading branch information
nyalldawson committed Apr 20, 2015
1 parent 5e41c43 commit 085d0ad09687fadeb01bcd0fdf1fbeb44b1e4bda
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/analysis/vector/qgszonalstatistics.cpp
@@ -246,6 +246,7 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
FeatureStats featureStats( statsStoreValues, statsStoreValueCount );
int featureCounter = 0;

QgsChangedAttributesMap changeMap;
while ( fi.nextFeature( f ) )
{
if ( p )
@@ -300,7 +301,6 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
}

//write the statistics value to the vector data provider
QgsChangedAttributesMap changeMap;
QgsAttributeMap changeAttributeMap;
if ( mStatistics & QgsZonalStatistics::Count )
changeAttributeMap.insert( countIndex, QVariant( featureStats.count ) );
@@ -364,11 +364,11 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
}

changeMap.insert( f.id(), changeAttributeMap );
vectorProvider->changeAttributeValues( changeMap );

++featureCounter;
}

vectorProvider->changeAttributeValues( changeMap );

if ( p )
{
p->setValue( featureCount );

0 comments on commit 085d0ad

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