Skip to content
Permalink
Browse files

Fix for zonal statistics (ticket #4972)

  • Loading branch information
mhugent committed Mar 18, 2012
1 parent c5769bf commit 9f57650eafec1bfa2d66c76e174d0a6b90a0726a
@@ -109,9 +109,9 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )

//add the new count, sum, mean fields to the provider
QList<QgsField> newFieldList;
QgsField countField( mAttributePrefix + "count", QVariant::Double );
QgsField sumField( mAttributePrefix + "sum", QVariant::Double );
QgsField meanField( mAttributePrefix + "mean", QVariant::Double );
QgsField countField( mAttributePrefix + "count", QVariant::Double, "double precision" );
QgsField sumField( mAttributePrefix + "sum", QVariant::Double, "double precision" );
QgsField meanField( mAttributePrefix + "mean", QVariant::Double, "double precision" );
newFieldList.push_back( countField );
newFieldList.push_back( sumField );
newFieldList.push_back( meanField );
@@ -68,7 +68,11 @@ void QgsZonalStatisticsDialog::insertAvailableLayers()
QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( layer_it.value() );
if ( vl && vl->geometryType() == QGis::Polygon )
{
mPolygonLayerComboBox->addItem( vl->name(), QVariant( vl->id() ) );
QgsVectorDataProvider* provider = vl->dataProvider();
if ( provider->capabilities() & QgsVectorDataProvider::AddAttributes )
{
mPolygonLayerComboBox->addItem( vl->name(), QVariant( vl->id() ) );
}
}
}
}

0 comments on commit 9f57650

Please sign in to comment.