mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Fix zonal stats not saving values to spatialite layers (fix #11849)
This commit is contained in:
parent
5e41c43242
commit
085d0ad096
@ -246,6 +246,7 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
|
|||||||
FeatureStats featureStats( statsStoreValues, statsStoreValueCount );
|
FeatureStats featureStats( statsStoreValues, statsStoreValueCount );
|
||||||
int featureCounter = 0;
|
int featureCounter = 0;
|
||||||
|
|
||||||
|
QgsChangedAttributesMap changeMap;
|
||||||
while ( fi.nextFeature( f ) )
|
while ( fi.nextFeature( f ) )
|
||||||
{
|
{
|
||||||
if ( p )
|
if ( p )
|
||||||
@ -300,7 +301,6 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
|
|||||||
}
|
}
|
||||||
|
|
||||||
//write the statistics value to the vector data provider
|
//write the statistics value to the vector data provider
|
||||||
QgsChangedAttributesMap changeMap;
|
|
||||||
QgsAttributeMap changeAttributeMap;
|
QgsAttributeMap changeAttributeMap;
|
||||||
if ( mStatistics & QgsZonalStatistics::Count )
|
if ( mStatistics & QgsZonalStatistics::Count )
|
||||||
changeAttributeMap.insert( countIndex, QVariant( featureStats.count ) );
|
changeAttributeMap.insert( countIndex, QVariant( featureStats.count ) );
|
||||||
@ -364,11 +364,11 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeMap.insert( f.id(), changeAttributeMap );
|
changeMap.insert( f.id(), changeAttributeMap );
|
||||||
vectorProvider->changeAttributeValues( changeMap );
|
|
||||||
|
|
||||||
++featureCounter;
|
++featureCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vectorProvider->changeAttributeValues( changeMap );
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
{
|
{
|
||||||
p->setValue( featureCount );
|
p->setValue( featureCount );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user