QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
16 #ifndef QGSALIGNRASTER_H
17 #define QGSALIGNRASTER_H
23 #include <gdal_version.h>
24 #include "qgis_analysis.h"
47 #include <gdal_version.h>
64 bool isValid()
const {
return nullptr != mDataset; }
67 QString
crs()
const {
return mCrsWkt; }
69 QSize
rasterSize()
const {
return QSize( mXSize, mYSize ); }
73 QSizeF cellSize()
const;
75 QPointF gridOffset()
const;
79 QPointF origin()
const;
85 double identify(
double mx,
double my );
93 double mGeoTransform[6];
133 Item(
const QString &input,
const QString &output )
134 : inputFilename( input )
135 , outputFilename( output )
136 , resampleMethod( RA_NearestNeighbour )
137 , rescaleValues( false )
138 , srcCellSizeInDestCRS( 0.0 )
155 typedef QList<QgsAlignRaster::Item>
List;
166 virtual bool progress(
double complete ) = 0;
181 void setGridOffset( QPointF offset ) { mGridOffsetX = offset.x(); mGridOffsetY = offset.y(); }
182 QPointF
gridOffset()
const {
return QPointF( mGridOffsetX, mGridOffsetY ); }
187 void setCellSize( QSizeF size ) { mCellSizeX = size.width(); mCellSizeY = size.height(); }
189 QSizeF
cellSize()
const {
return QSizeF( mCellSizeX, mCellSizeY ); }
200 void setClipExtent(
double xmin,
double ymin,
double xmax,
double ymax );
225 bool setParametersFromRaster(
const RasterInfo &rasterInfo,
const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
231 bool setParametersFromRaster(
const QString &filename,
const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
237 bool checkInputParameters();
243 QSize alignedRasterSize()
const;
267 int suggestedReferenceLayer()
const;
272 bool createAndWarp(
const Item &raster );
275 static bool suggestedWarpOutput(
const RasterInfo &info,
const QString &destWkt, QSizeF *cellSize =
nullptr, QPointF *gridOffset =
nullptr,
QgsRectangle *rect =
nullptr );
301 double mClipExtent[4];
306 double mGeoTransform[6];
316 #endif // QGSALIGNRASTER_H
QPointF gridOffset() const
QSize rasterSize() const
Returns the size of the raster grid in pixels.
@ RA_Lanczos
Lanczos windowed sinc interpolation (6x6 kernel)
QSizeF cellSize() const
Gets output cell size.
QgsAlignRaster takes one or more raster layers and warps (resamples) them so they have the same:
QString inputFilename
filename of the source raster
@ RA_Bilinear
Bilinear (2x2 kernel)
Utility class for gathering information about rasters.
gdal::dataset_unique_ptr mDataset
handle to open GDAL dataset
QString errorMessage() const
Returns the error from a previous run() call.
int bandCount() const
Returns the number of raster bands in the file.
bool rescaleValues
rescaling of values according to the change of pixel size
List mRasters
List of rasters to be aligned (with their output files and other options)
void setCellSize(QSizeF size)
Sets output cell size.
@ RA_NearestNeighbour
Nearest neighbour (select on one input pixel)
int mXSize
Computed raster grid width.
void setGridOffset(QPointF offset)
QString crs() const
Returns the CRS in WKT format.
void setDestinationCrs(const QString &crsWkt)
Sets the output CRS in WKT format.
@ RA_Q3
Third quartile (selects the third quartile of all non-NODATA contributing pixels)
void setCellSize(double x, double y)
Sets output cell size.
@ RA_Mode
Mode (selects the value which appears most often of all the sampled points)
std::unique_ptr< std::remove_pointer< GDALDatasetH >::type, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
QString destinationCrs() const
Gets the output CRS in WKT format.
@ RA_Median
Median (selects the median of all non-NODATA contributing pixels)
@ RA_Cubic
Cubic Convolution Approximation (4x4 kernel)
@ RA_Max
Maximum (selects the maximum of all non-NODATA contributing pixels)
QString outputFilename
filename of the newly created aligned raster (will be overwritten if exists already)
int mYSize
Computed raster grid height.
double srcCellSizeInDestCRS
used for rescaling of values (if necessary)
Helper struct to be sub-classed for progress reporting.
void setRasters(const List &list)
Sets list of rasters that will be aligned.
QList< QgsAlignRaster::Item > List
QString mErrorMessage
Last error message from run()
QString mCrsWkt
CRS stored in WKT format.
Item(const QString &input, const QString &output)
Definition of one raster layer for alignment.
@ RA_Min
Minimum (selects the minimum of all non-NODATA contributing pixels)
@ RA_Average
Average (computes the average of all non-NODATA contributing pixels)
@ RA_Q1
First quartile (selects the first quartile of all non-NODATA contributing pixels)
ResampleAlg
Resampling algorithm to be used (equivalent to GDAL's enum GDALResampleAlg)
QgsAlignRaster::ResampleAlg resampleMethod
resampling method to be used
QString mCrsWkt
Destination CRS - stored in well-known text (WKT) format.
@ RA_CubicSpline
Cubic B-Spline Approximation (4x4 kernel)
ProgressHandler * progressHandler() const
Gets associated progress handler. May be nullptr (default)
void setProgressHandler(ProgressHandler *progressHandler)
Assign a progress handler instance. Does not take ownership. nullptr can be passed.
bool isValid() const
Check whether the given path is a valid raster.
List rasters() const
Gets list of rasters that will be aligned.