Skip to content

Commit

Permalink
Fix for zonal statistics (ticket #4972)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Mar 18, 2012
1 parent c5769bf commit 9f57650
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/analysis/vector/qgszonalstatistics.cpp
Expand Up @@ -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 );
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp
Expand Up @@ -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() ) );
}
}
}
}
Expand Down

0 comments on commit 9f57650

Please sign in to comment.