QGIS API Documentation 3.41.0-Master (cea29feecf2)
|
QgsAlignRaster takes one or more raster layers and warps (resamples) them so they have the same: More...
#include <qgsalignraster.h>
Classes | |
struct | ProgressHandler |
Helper struct to be sub-classed for progress reporting. More... | |
struct | RasterInfo |
Utility class for gathering information about rasters. More... | |
Public Types | |
typedef QgsAlignRasterData::RasterItem | Item |
typedef QList< QgsAlignRasterData::RasterItem > | List |
typedef Qgis::GdalResampleAlgorithm | ResampleAlg |
Public Member Functions | |
QgsAlignRaster () | |
QgsRectangle | alignedRasterExtent () const |
Returns the expected extent of the resulting aligned raster. | |
QSize | alignedRasterSize () const |
Returns the expected size of the resulting aligned raster. | |
QSizeF | cellSize () const |
Gets output cell size. | |
bool | checkInputParameters () |
Determine destination extent from the input rasters and calculate derived values. | |
QgsRectangle | clipExtent () const |
Gets clipping extent (region of interest). | |
QString | destinationCrs () const |
Gets the output CRS in WKT format. | |
void | dump () const |
write contents of the object to standard error stream - for debugging | |
QString | errorMessage () const |
Returns the error from a previous run() call. | |
QPointF | gridOffset () const |
ProgressHandler * | progressHandler () const |
Gets associated progress handler. May be nullptr (default) | |
List | rasters () const |
Gets list of rasters that will be aligned. | |
bool | run () |
Run the alignment process. | |
void | setCellSize (double x, double y) |
Sets output cell size. | |
void | setCellSize (QSizeF size) |
Sets output cell size. | |
void | setClipExtent (const QgsRectangle &extent) |
Configure clipping extent (region of interest). | |
void | setClipExtent (double xmin, double ymin, double xmax, double ymax) |
Configure clipping extent (region of interest). | |
void | setDestinationCrs (const QString &crsWkt) |
Sets the output CRS in WKT format. | |
void | setGridOffset (QPointF offset) |
bool | setParametersFromRaster (const QString &filename, const QString &customCRSWkt=QString(), QSizeF customCellSize=QSizeF(), QPointF customGridOffset=QPointF(-1, -1)) |
Overridden variant for convenience, taking filename instead RasterInfo object. | |
bool | setParametersFromRaster (const RasterInfo &rasterInfo, const QString &customCRSWkt=QString(), QSizeF customCellSize=QSizeF(), QPointF customGridOffset=QPointF(-1, -1)) |
Set destination CRS, cell size and grid offset from a raster file. | |
void | setProgressHandler (ProgressHandler *progressHandler) |
Assign a progress handler instance. Does not take ownership. nullptr can be passed. | |
void | setRasters (const List &list) |
Sets list of rasters that will be aligned. | |
int | suggestedReferenceLayer () const |
Returns the index of the layer which has smallest cell size (returns -1 on error) | |
Protected Member Functions | |
bool | createAndWarp (const Item &raster) |
Internal function for processing of one raster (1. create output, 2. do the alignment) | |
Static Protected Member Functions | |
static bool | suggestedWarpOutput (const RasterInfo &info, const QString &destWkt, QSizeF *cellSize=nullptr, QPointF *gridOffset=nullptr, QgsRectangle *rect=nullptr) |
Determine suggested output of raster warp to a different CRS. Returns true on success. | |
Protected Attributes | |
double | mCellSizeX |
Destination cell size. | |
double | mCellSizeY |
double | mClipExtent [4] |
Optional clip extent: sets "requested area" which be extended to fit the raster grid. | |
QString | mCrsWkt |
Destination CRS - stored in well-known text (WKT) format. | |
QString | mErrorMessage |
Last error message from run() | |
double | mGeoTransform [6] |
Computed geo-transform. | |
double | mGridOffsetX |
Destination grid offset - expected to be in interval <0,cellsize) | |
double | mGridOffsetY |
ProgressHandler * | mProgressHandler = nullptr |
Object that facilitates reporting of progress / cancellation. | |
List | mRasters |
List of rasters to be aligned (with their output files and other options) | |
int | mXSize |
Computed raster grid width. | |
int | mYSize |
Computed raster grid height. | |
QgsAlignRaster takes one or more raster layers and warps (resamples) them so they have the same:
Definition at line 44 of file qgsalignraster.h.
Definition at line 109 of file qgsalignraster.h.
typedef QList<QgsAlignRasterData::RasterItem> QgsAlignRaster::List |
Definition at line 110 of file qgsalignraster.h.
Definition at line 108 of file qgsalignraster.h.
QgsAlignRaster::QgsAlignRaster | ( | ) |
Definition at line 110 of file qgsalignraster.cpp.
QgsRectangle QgsAlignRaster::alignedRasterExtent | ( | ) | const |
Returns the expected extent of the resulting aligned raster.
Definition at line 346 of file qgsalignraster.cpp.
QSize QgsAlignRaster::alignedRasterSize | ( | ) | const |
Returns the expected size of the resulting aligned raster.
Definition at line 341 of file qgsalignraster.cpp.
|
inline |
Gets output cell size.
Definition at line 151 of file qgsalignraster.h.
bool QgsAlignRaster::checkInputParameters | ( | ) |
Determine destination extent from the input rasters and calculate derived values.
true
on success, sets error on error (see errorMessage()) Definition at line 227 of file qgsalignraster.cpp.
QgsRectangle QgsAlignRaster::clipExtent | ( | ) | const |
Gets clipping extent (region of interest).
No extra clipping is done if the rectangle is null
Definition at line 136 of file qgsalignraster.cpp.
|
protected |
Internal function for processing of one raster (1. create output, 2. do the alignment)
Definition at line 417 of file qgsalignraster.cpp.
|
inline |
Gets the output CRS in WKT format.
Definition at line 156 of file qgsalignraster.h.
void QgsAlignRaster::dump | ( | ) | const |
write contents of the object to standard error stream - for debugging
Definition at line 372 of file qgsalignraster.cpp.
|
inline |
Returns the error from a previous run() call.
Error message is empty if run() succeeded (returned true
)
Definition at line 223 of file qgsalignraster.h.
|
inline |
Definition at line 140 of file qgsalignraster.h.
|
inline |
Gets associated progress handler. May be nullptr
(default)
Definition at line 128 of file qgsalignraster.h.
|
inline |
Gets list of rasters that will be aligned.
Definition at line 133 of file qgsalignraster.h.
bool QgsAlignRaster::run | ( | ) |
Run the alignment process.
true
on success, sets error on error (see errorMessage()) Definition at line 352 of file qgsalignraster.cpp.
|
inline |
Sets output cell size.
Definition at line 143 of file qgsalignraster.h.
|
inline |
Sets output cell size.
Definition at line 145 of file qgsalignraster.h.
void QgsAlignRaster::setClipExtent | ( | const QgsRectangle & | extent | ) |
Configure clipping extent (region of interest).
No extra clipping is done if the rectangle is null
Definition at line 131 of file qgsalignraster.cpp.
void QgsAlignRaster::setClipExtent | ( | double | xmin, |
double | ymin, | ||
double | xmax, | ||
double | ymax | ||
) |
Configure clipping extent (region of interest).
No extra clipping is done if the rectangle is null
Definition at line 123 of file qgsalignraster.cpp.
|
inline |
Sets the output CRS in WKT format.
Definition at line 154 of file qgsalignraster.h.
|
inline |
Definition at line 135 of file qgsalignraster.h.
bool QgsAlignRaster::setParametersFromRaster | ( | const QString & | filename, |
const QString & | customCRSWkt = QString() , |
||
QSizeF | customCellSize = QSizeF() , |
||
QPointF | customGridOffset = QPointF( -1, -1 ) |
||
) |
Overridden variant for convenience, taking filename instead RasterInfo object.
See the other variant for details.
Definition at line 142 of file qgsalignraster.cpp.
bool QgsAlignRaster::setParametersFromRaster | ( | const RasterInfo & | rasterInfo, |
const QString & | customCRSWkt = QString() , |
||
QSizeF | customCellSize = QSizeF() , |
||
QPointF | customGridOffset = QPointF( -1, -1 ) |
||
) |
Set destination CRS, cell size and grid offset from a raster file.
The user may provide custom values for some of the parameters - in such case only the remaining parameters are calculated.
If default CRS is used, the parameters are set according to the raster file's geo-transform. If a custom CRS is provided, suggested reprojection is calculated first (using GDAL) in order to determine suitable defaults for cell size and grid offset.
true
on success (may fail if it is not possible to reproject raster to given CRS) Definition at line 147 of file qgsalignraster.cpp.
|
inline |
Assign a progress handler instance. Does not take ownership. nullptr
can be passed.
Definition at line 126 of file qgsalignraster.h.
|
inline |
Sets list of rasters that will be aligned.
Definition at line 131 of file qgsalignraster.h.
int QgsAlignRaster::suggestedReferenceLayer | ( | ) | const |
Returns the index of the layer which has smallest cell size (returns -1 on error)
Definition at line 385 of file qgsalignraster.cpp.
|
staticprotected |
Determine suggested output of raster warp to a different CRS. Returns true
on success.
Definition at line 504 of file qgsalignraster.cpp.
|
protected |
Destination cell size.
Definition at line 253 of file qgsalignraster.h.
|
protected |
Definition at line 253 of file qgsalignraster.h.
|
protected |
Optional clip extent: sets "requested area" which be extended to fit the raster grid.
Clipping not done if all coords are zeroes.
Definition at line 261 of file qgsalignraster.h.
|
protected |
Destination CRS - stored in well-known text (WKT) format.
Definition at line 251 of file qgsalignraster.h.
|
protected |
Last error message from run()
Definition at line 245 of file qgsalignraster.h.
|
protected |
Computed geo-transform.
Definition at line 266 of file qgsalignraster.h.
|
protected |
Destination grid offset - expected to be in interval <0,cellsize)
Definition at line 255 of file qgsalignraster.h.
|
protected |
Definition at line 255 of file qgsalignraster.h.
|
protected |
Object that facilitates reporting of progress / cancellation.
Definition at line 242 of file qgsalignraster.h.
|
protected |
List of rasters to be aligned (with their output files and other options)
Definition at line 248 of file qgsalignraster.h.
|
protected |
Computed raster grid width.
Definition at line 268 of file qgsalignraster.h.
|
protected |
Computed raster grid height.
Definition at line 271 of file qgsalignraster.h.