Skip to content

Commit

Permalink
fix rasterize mesh when there is no data
Browse files Browse the repository at this point in the history
  • Loading branch information
vcloarec authored and nyalldawson committed Jun 10, 2021
1 parent 5864629 commit a1ec458
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/analysis/processing/qgsalgorithmexportmesh.cpp
Expand Up @@ -834,20 +834,24 @@ QVariantMap QgsMeshRasterizeAlgorithm::processAlgorithm( const QVariantMap &para
if ( feedback )
QObject::connect( &rasterBlockFeedBack, &QgsFeedback::canceled, feedback, &QgsFeedback::cancel );

QgsRasterBlock *block = QgsMeshUtils::exportRasterBlock(
mTriangularMesh,
dataGroup.datasetValues,
dataGroup.activeFaces,
dataGroup.metadata.dataType(),
mTransform,
pixelSize,
extent,
&rasterBlockFeedBack );


if ( dataGroup.datasetValues.isValid() )
{
QgsRasterBlock *block = QgsMeshUtils::exportRasterBlock(
mTriangularMesh,
dataGroup.datasetValues,
dataGroup.activeFaces,
dataGroup.metadata.dataType(),
mTransform,
pixelSize,
extent,
&rasterBlockFeedBack );

rasterDataProvider->writeBlock( block, i + 1 );
rasterDataProvider->setNoDataValue( i + 1, block->noDataValue() );
}
else
rasterDataProvider->setNoDataValue( i + 1, std::numeric_limits<double>::quiet_NaN() );

rasterDataProvider->writeBlock( block, i + 1 );
rasterDataProvider->setNoDataValue( i + 1, block->noDataValue() );
if ( feedback )
{
if ( feedback->isCanceled() )
Expand Down

0 comments on commit a1ec458

Please sign in to comment.