QgsRasterProjector class

QgsRasterProjector implements approximate projection support for it calculates grid of points in source CRS for target CRS + extent which are used to calculate affine transformation matrices.

Base classes

class QgsRasterInterface
Base class for processing filters like renderers, reprojector, resampler etc.

Public types

enum Precision { Approximate = 0, Exact = 1 }
Precision defines if each pixel is reprojected or approximate reprojection based on an approximation matrix of reprojected points is used.

Public static functions

static auto extentSize(const QgsCoordinateTransform& ct, const QgsRectangle& srcExtent, int srcXSize, int srcYSize, QgsRectangle& destExtent, int& destXSize, int& destYSize) -> bool
Calculate destination extent and size from source extent and size.

Public functions

auto bandCount() const -> int override
Gets number of bands.
auto block(int bandNo, const QgsRectangle& extent, int width, int height, QgsRasterBlockFeedback* feedback = nullptr) -> QgsRasterBlock* override
Read block of data using given extent and size.
auto clone() const -> QgsRasterProjector* override
Clone itself, create deep copy.
auto dataType(int bandNo) const -> Qgis::DataType override
Returns data type for the band specified by number.
auto destExtentSize(const QgsRectangle& srcExtent, int srcXSize, int srcYSize, QgsRectangle& destExtent, int& destXSize, int& destYSize) -> bool
Calculate destination extent and size from source extent and size.
auto destinationCrs() const -> QgsCoordinateReferenceSystem
Returns the destination CRS.
void setCrs(const QgsCoordinateReferenceSystem& srcCRS, const QgsCoordinateReferenceSystem& destCRS, int srcDatumTransform = -1, int destDatumTransform = -1)
Sets the source and destination CRS.
auto sourceCrs() const -> QgsCoordinateReferenceSystem
Returns the source CRS.

Enum documentation

enum QgsRasterProjector::Precision

Precision defines if each pixel is reprojected or approximate reprojection based on an approximation matrix of reprojected points is used.

Enumerators
Approximate

Approximate (default), fast but possibly inaccurate.

Exact

Exact, precise but slow.

Function documentation

QgsRasterBlock* QgsRasterProjector::block(int bandNo, const QgsRectangle& extent, int width, int height, QgsRasterBlockFeedback* feedback = nullptr) override

Read block of data using given extent and size.

Parameters
bandNo band number
extent extent of block
width pixel width of block
height pixel height of block
feedback optional raster feedback object for cancelation/preview. Added in QGIS 3.0.

Returns pointer to data. Caller is responsible to free the memory returned.