Skip to content

Commit

Permalink
Add support for postgresraster based rasters in Raster Calculator (#4…
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrocha committed May 30, 2021
1 parent 02266ef commit bbb74b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsrastercalculator.cpp
Expand Up @@ -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 )
Expand Down
15 changes: 6 additions & 9 deletions src/app/qgsrastercalcdialog.cpp
Expand Up @@ -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 );
}
}

Expand Down

0 comments on commit bbb74b8

Please sign in to comment.