Skip to content
Permalink
Browse files

Use default raster iterator tile size

  • Loading branch information
nyalldawson committed Jun 12, 2018
1 parent e45958e commit dcd872ba152044fb30c56d3a876041a9af0c863b
@@ -123,15 +123,13 @@ QVariantMap QgsRasterLayerUniqueValuesReportAlgorithm::processAlgorithm( const Q
qgssize noDataCount = 0;

qgssize layerSize = static_cast< qgssize >( mLayerWidth ) * static_cast< qgssize >( mLayerHeight );
int maxWidth = 4000;
int maxHeight = 4000;
int maxWidth = QgsRasterIterator::DEFAULT_MAXIMUM_TILE_WIDTH;
int maxHeight = QgsRasterIterator::DEFAULT_MAXIMUM_TILE_HEIGHT;
int nbBlocksWidth = std::ceil( 1.0 * mLayerWidth / maxWidth );
int nbBlocksHeight = std::ceil( 1.0 * mLayerHeight / maxHeight );
int nbBlocks = nbBlocksWidth * nbBlocksHeight;

QgsRasterIterator iter( mInterface.get() );
iter.setMaximumTileWidth( maxWidth );
iter.setMaximumTileHeight( maxHeight );
iter.startRasterRead( mBand, mLayerWidth, mLayerHeight, mExtent );

int iterLeft = 0;
@@ -65,12 +65,7 @@ void QgsRasterAnalysisUtils::statisticsFromMiddlePointTest( QgsRasterInterface *
}
polyEngine->prepareGeometry();

const int maxWidth = 4000;
const int maxHeight = 4000;

QgsRasterIterator iter( rasterInterface );
iter.setMaximumTileWidth( maxWidth );
iter.setMaximumTileHeight( maxHeight );
iter.startRasterRead( rasterBand, nCellsX, nCellsY, rasterBBox );

std::unique_ptr< QgsRasterBlock > block;
@@ -118,12 +113,7 @@ void QgsRasterAnalysisUtils::statisticsFromPreciseIntersection( QgsRasterInterfa
}
polyEngine->prepareGeometry();

const int maxWidth = 4000;
const int maxHeight = 4000;

QgsRasterIterator iter( rasterInterface );
iter.setMaximumTileWidth( maxWidth );
iter.setMaximumTileHeight( maxHeight );
iter.startRasterRead( rasterBand, nCellsX, nCellsY, rasterBBox );

std::unique_ptr< QgsRasterBlock > block;
@@ -31,12 +31,10 @@ void QgsReclassifyUtils::reclassify( const QVector<QgsReclassifyUtils::RasterCla
QgsRasterDataProvider *destinationRaster, double destNoDataValue, bool useNoDataForMissingValues,
QgsProcessingFeedback *feedback )
{
int maxWidth = 4000;
int maxHeight = 4000;
int maxWidth = QgsRasterIterator::DEFAULT_MAXIMUM_TILE_WIDTH;
int maxHeight = QgsRasterIterator::DEFAULT_MAXIMUM_TILE_HEIGHT;

QgsRasterIterator iter( sourceRaster );
iter.setMaximumTileWidth( maxWidth );
iter.setMaximumTileHeight( maxHeight );
iter.startRasterRead( band, sourceWidthPixels, sourceHeightPixels, extent );

int nbBlocksWidth = static_cast< int >( std::ceil( 1.0 * sourceWidthPixels / maxWidth ) );

0 comments on commit dcd872b

Please sign in to comment.
You can’t perform that action at this time.