16 #ifndef QGSALIGNRASTER_H 17 #define QGSALIGNRASTER_H 23 #include <gdal_version.h> 24 #include "qgis_analysis.h" 46 #include <gdal_version.h> 63 bool isValid()
const {
return nullptr != mDataset; }
66 QString
crs()
const {
return mCrsWkt; }
68 QSize
rasterSize()
const {
return QSize( mXSize, mYSize ); }
72 QSizeF cellSize()
const;
74 QPointF gridOffset()
const;
78 QPointF origin()
const;
84 double identify(
double mx,
double my );
92 double mGeoTransform[6];
132 Item(
const QString &input,
const QString &output )
133 : inputFilename( input )
134 , outputFilename( output )
135 , resampleMethod( RA_NearestNeighbour )
136 , rescaleValues( false )
137 , srcCellSizeInDestCRS( 0.0 )
154 typedef QList<QgsAlignRaster::Item>
List;
165 virtual bool progress(
double complete ) = 0;
180 void setGridOffset( QPointF offset ) { mGridOffsetX = offset.x(); mGridOffsetY = offset.y(); }
181 QPointF
gridOffset()
const {
return QPointF( mGridOffsetX, mGridOffsetY ); }
186 void setCellSize( QSizeF size ) { mCellSizeX = size.width(); mCellSizeY = size.height(); }
188 QSizeF
cellSize()
const {
return QSizeF( mCellSizeX, mCellSizeY ); }
199 void setClipExtent(
double xmin,
double ymin,
double xmax,
double ymax );
224 bool setParametersFromRaster(
const RasterInfo &rasterInfo,
const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
230 bool setParametersFromRaster(
const QString &filename,
const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
236 bool checkInputParameters();
242 QSize alignedRasterSize()
const;
266 int suggestedReferenceLayer()
const;
271 bool createAndWarp(
const Item &raster );
274 static bool suggestedWarpOutput(
const RasterInfo &info,
const QString &destWkt, QSizeF *cellSize =
nullptr, QPointF *gridOffset =
nullptr,
QgsRectangle *rect =
nullptr );
300 double mClipExtent[4];
305 double mGeoTransform[6];
315 #endif // QGSALIGNRASTER_H List rasters() const
Get list of rasters that will be aligned.
A rectangle specified with double values.
QString destinationCrs() const
Get the output CRS in WKT format.
gdal::dataset_unique_ptr mDataset
handle to open GDAL dataset
bool rescaleValues
rescaling of values according to the change of pixel size
Nearest neighbour (select on one input pixel)
QSize rasterSize() const
Return size of the raster grid in pixels.
List mRasters
List of rasters to be aligned (with their output files and other options)
QString errorMessage() const
Return error from a previous run() call.
Mode (selects the value which appears most often of all the sampled points)
QString outputFilename
filename of the newly created aligned raster (will be overwritten if exists already) ...
Median (selects the median of all non-NODATA contributing pixels)
Cubic Convolution Approximation (4x4 kernel)
int mYSize
Computed raster grid height.
int bandCount() const
Return number of raster bands in the file.
void setCellSize(QSizeF size)
Set output cell size.
void setDestinationCrs(const QString &crsWkt)
Set the output CRS in WKT format.
QString crs() const
Return CRS in WKT format.
void setRasters(const List &list)
Set list of rasters that will be aligned.
Definition of one raster layer for alignment.
QgsAlignRaster takes one or more raster layers and warps (resamples) them so they have the same: ...
Helper struct to be sub-classed for progress reporting.
double srcCellSizeInDestCRS
used for rescaling of values (if necessary)
void setGridOffset(QPointF offset)
Third quartile (selects the third quartile of all non-NODATA contributing pixels) ...
QString mCrsWkt
CRS stored in WKT format.
std::unique_ptr< void, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
ResampleAlg
Resampling algorithm to be used (equivalent to GDAL's enum GDALResampleAlg)
ProgressHandler * progressHandler() const
Get associated progress handler. May be nullptr (default)
Average (computes the average of all non-NODATA contributing pixels)
int mXSize
Computed raster grid width.
Maximum (selects the maximum of all non-NODATA contributing pixels)
QList< QgsAlignRaster::Item > List
Item(const QString &input, const QString &output)
First quartile (selects the first quartile of all non-NODATA contributing pixels) ...
void setProgressHandler(ProgressHandler *progressHandler)
Assign a progress handler instance. Does not take ownership. nullptr can be passed.
void setCellSize(double x, double y)
Set output cell size.
bool isValid() const
Check whether the given path is a valid raster.
QString mErrorMessage
Last error message from run()
Cubic B-Spline Approximation (4x4 kernel)
QgsAlignRaster::ResampleAlg resampleMethod
resampling method to be used
QString inputFilename
filename of the source raster
Lanczos windowed sinc interpolation (6x6 kernel)
Minimum (selects the minimum of all non-NODATA contributing pixels)
Utility class for gathering information about rasters.
QString mCrsWkt
Destination CRS - stored in well-known text (WKT) format.
QPointF gridOffset() const
QSizeF cellSize() const
Get output cell size.