Subgroup: other
Class: QgsAlignRaster¶
-
class
qgis.analysis.
QgsAlignRaster
¶ Bases:
sip.wrapper
QgsAlignRaster takes one or more raster layers and warps (resamples) themso they have the same: - coordinate reference system - cell size and raster size - offset of the raster grid
New in version 2.12: Methods
alignedRasterExtent
Return expected extent of the resulting aligned raster alignedRasterSize
Return expected size of the resulting aligned raster cellSize
Get output cell size checkInputParameters
Determine destination extent from the input rasters and calculate derived values clipExtent
Get clipping extent (region of interest). createAndWarp
Internal function for processing of one raster (1. destinationCrs
Get the output CRS in WKT format dump
write contents of the object to standard error stream - for debugging errorMessage
Return error from a previous run() call. gridOffset
progressHandler
Get associated progress handler. rasters
Get list of rasters that will be aligned run
Run the alignment process setCellSize
Set output cell size setClipExtent
Configure clipping extent (region of interest). setDestinationCrs
Set the output CRS in WKT format setGridOffset
setParametersFromRaster
Set destination CRS, cell size and grid offset from a raster file. setProgressHandler
Assign a progress handler instance. setRasters
Set list of rasters that will be aligned suggestedReferenceLayer
Return index of the layer which has smallest cell size (returns -1 on error) suggestedWarpOutput
Determine suggested output of raster warp to a different CRS. Signals
Attributes
RA_Average
RA_Bilinear
RA_Cubic
RA_CubicSpline
RA_Lanczos
RA_Max
RA_Median
RA_Min
RA_Mode
RA_NearestNeighbour
RA_Q1
RA_Q3
-
class
Item
(input: str, output: str)¶ Bases:
sip.wrapper
QgsAlignRaster.Item(QgsAlignRaster.Item)
-
inputFilename
¶
-
outputFilename
¶
-
resampleMethod
¶
-
rescaleValues
¶
-
srcCellSizeInDestCRS
¶
-
-
class
ProgressHandler
¶ Bases:
sip.wrapper
QgsAlignRaster.ProgressHandler(QgsAlignRaster.ProgressHandler)
-
progress
(self, complete: float) → bool¶ Method to be overridden for progress reporting.
Parameters: complete – Overall progress of the alignment operation Returns: false if the execution should be canceled, true otherwise
-
-
RA_Average
= 5¶
-
RA_Bilinear
= 1¶
-
RA_Cubic
= 2¶
-
RA_CubicSpline
= 3¶
-
RA_Lanczos
= 4¶
-
RA_Max
= 8¶
-
RA_Median
= 10¶
-
RA_Min
= 9¶
-
RA_Mode
= 6¶
-
RA_NearestNeighbour
= 0¶
-
RA_Q1
= 11¶
-
RA_Q3
= 12¶
-
class
RasterInfo
(layerpath: str)¶ Bases:
sip.wrapper
Construct raster info with a path to a raster file
-
bandCount
(self) → int¶ Return number of raster bands in the file
-
cellSize
(self) → QSizeF¶ Return cell size in map units
-
crs
(self) → str¶ Return CRS in WKT format
-
dump
(self)¶ write contents of the object to standard error stream - for debugging
-
extent
(self) → QgsRectangle¶ Return extent of the raster
-
gridOffset
(self) → QPointF¶ Return grid offset
-
identify
(self, mx: float, my: float) → float¶ Get raster value at the given coordinates (from the first band)
-
isValid
(self) → bool¶ Check whether the given path is a valid raster
-
origin
(self) → QPointF¶ Return origin of the raster
-
rasterSize
(self) → QSize¶ Return size of the raster grid in pixels
-
-
class
ResampleAlg
¶ Bases:
int
-
alignedRasterExtent
(self) → QgsRectangle¶ Return expected extent of the resulting aligned raster
Note
first need to run checkInputParameters() which returns with success
-
alignedRasterSize
(self) → QSize¶ Return expected size of the resulting aligned raster
Note
first need to run checkInputParameters() which returns with success
-
cellSize
(self) → QSizeF¶ Get output cell size
-
checkInputParameters
(self) → bool¶ Determine destination extent from the input rasters and calculate derived values
Returns: true on success, sets error on error (see errorMessage())
-
clipExtent
(self) → QgsRectangle¶ Get clipping extent (region of interest). No extra clipping is done if the rectangle is null
-
createAndWarp
(self, raster: QgsAlignRaster.Item) → bool¶ Internal function for processing of one raster (1. create output, 2. do the alignment)
-
destinationCrs
(self) → str¶ Get the output CRS in WKT format
-
dump
(self)¶ write contents of the object to standard error stream - for debugging
-
errorMessage
(self) → str¶ Return error from a previous run() call. Error message is empty if run() succeeded (returned true)
-
gridOffset
(self) → QPointF¶
-
progressHandler
(self) → QgsAlignRaster.ProgressHandler¶ Get associated progress handler. May be None (default)
-
rasters
(self) → object¶ Get list of rasters that will be aligned
-
run
(self) → bool¶ Run the alignment process
Returns: true on success, sets error on error (see errorMessage())
-
setCellSize
(self, x: float, y: float)¶ Set output cell size
setCellSize(self, size: QSizeF) Set output cell size
-
setClipExtent
(self, xmin: float, ymin: float, xmax: float, ymax: float)¶ Configure clipping extent (region of interest). No extra clipping is done if the rectangle is null
setClipExtent(self, extent: QgsRectangle) Configure clipping extent (region of interest). No extra clipping is done if the rectangle is null
-
setDestinationCrs
(self, crsWkt: str)¶ Set the output CRS in WKT format
-
setGridOffset
(self, offset: Union[QPointF, QPoint])¶
-
setParametersFromRaster
(self, rasterInfo: QgsAlignRaster.RasterInfo, customCRSWkt: str = '', customCellSize: QSizeF = QSizeF(), customGridOffset: Union[QPointF, QPoint] = QPointF(-1, -1)) → bool¶ 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.
Returns: true on success (may fail if it is not possible to reproject raster to given CRS) setParametersFromRaster(self, filename: str, customCRSWkt: str = ‘’, customCellSize: QSizeF = QSizeF(), customGridOffset: Union[QPointF, QPoint] = QPointF(-1,-1)) -> bool Overridden variant for convenience, taking filename instead RasterInfo object. See the other variant for details.
-
setProgressHandler
(self, progressHandler: QgsAlignRaster.ProgressHandler)¶ Assign a progress handler instance. Does not take ownership. None can be passed.
-
setRasters
(self, list: object)¶ Set list of rasters that will be aligned
-
suggestedReferenceLayer
(self) → int¶ Return index of the layer which has smallest cell size (returns -1 on error)
-
suggestedWarpOutput
(info: QgsAlignRaster.RasterInfo, destWkt: str, cellSize: QSizeF = None, gridOffset: Union[QPointF, QPoint] = None, rect: QgsRectangle = None) → bool¶ Determine suggested output of raster warp to a different CRS. Returns true on success
-
class