Skip to content
Permalink
Browse files
Add support for postgresraster based rasters in Raster Calculator (#4…
  • Loading branch information
jgrocha committed May 30, 2021
1 parent 02266ef commit bbb74b8f3a10c10025398519c7a644adc1f6932a
Showing with 7 additions and 10 deletions.
  1. +1 −1 src/analysis/raster/qgsrastercalculator.cpp
  2. +6 −9 src/app/qgsrastercalcdialog.cpp
@@ -735,7 +735,7 @@ QVector<QgsRasterCalculatorEntry> QgsRasterCalculatorEntry::rasterEntries()
for ( ; layerIt != layers.constEnd(); ++layerIt )
{
QgsRasterLayer *rlayer = qobject_cast<QgsRasterLayer *>( layerIt.value() );
if ( rlayer && rlayer->dataProvider() && rlayer->providerType() == QLatin1String( "gdal" ) )
if ( rlayer && rlayer->dataProvider() && ( rlayer->dataProvider()->capabilities() & QgsRasterDataProvider::Size ) )
{
//get number of bands
for ( int i = 0; i < rlayer->bandCount(); ++i )
@@ -186,17 +186,14 @@ void QgsRasterCalcDialog::insertAvailableRasterBands()
for ( const auto &entry : std::as_const( mAvailableRasterBands ) )
{
QgsRasterLayer *rlayer = entry.raster;
if ( rlayer && rlayer->dataProvider() && rlayer->providerType() == QLatin1String( "gdal" ) )
if ( !mExtentSizeSet ) //set bounding box / resolution of output to the values of the first possible input layer
{
if ( !mExtentSizeSet ) //set bounding box / resolution of output to the values of the first possible input layer
{
setExtentSize( rlayer->width(), rlayer->height(), rlayer->extent() );
mCrsSelector->setCrs( rlayer->crs() );
}
QListWidgetItem *item = new QListWidgetItem( entry.ref, mRasterBandsListWidget );
item->setData( Qt::ToolTipRole, rlayer->publicSource() );
mRasterBandsListWidget->addItem( item );
setExtentSize( rlayer->width(), rlayer->height(), rlayer->extent() );
mCrsSelector->setCrs( rlayer->crs() );
}
QListWidgetItem *item = new QListWidgetItem( entry.ref, mRasterBandsListWidget );
item->setData( Qt::ToolTipRole, rlayer->publicSource() );
mRasterBandsListWidget->addItem( item );
}
}

0 comments on commit bbb74b8

Please sign in to comment.