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

This commit is contained in:
Nyall Dawson 2015-04-20 18:20:23 +10:00
parent 5e41c43242
commit 085d0ad096

View File

@ -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 );