Subgroup: Raster
Class: QgsRasterInterface¶
-
class
qgis.core.
QgsRasterInterface
¶ Bases:
sip.wrapper
Base class for processing filters like renderers, reprojector, resampler etc.
Methods
bandCount
Get number of bands bandStatistics
Get band statistics. block
Read block of data using given extent and size. capabilities
Returns a bitmask containing the supported capabilities capabilitiesString
Returns the above in friendly format. clone
Clone itself, create deep copy cumulativeCut
Find values for cumulative pixel count cut. dataType
Returns data type for the band specified by number dataTypeSize
extent
Get the extent of the interface. generateBandName
helper function to create zero padded band names hasHistogram
Returns true if histogram is available (cached, already calculated) hasStatistics
Returns true if histogram is available (cached, already calculated). histogram
Get histogram. initHistogram
Fill in histogram defaults if not specified initStatistics
Fill in statistics defaults if not specified input
Current input on
Is on/off readXml
Sets base class members from xml. setInput
Set input. setOn
Set on/off sourceDataType
Returns source data type for the band specified by number, sourceInput
Get source / raw input, the first in pipe, usually provider. writeXml
Write base class members to xml. xBlockSize
Get block size xSize
Get raster size yBlockSize
ySize
Attributes
BuildPyramids
Create
Identify
IdentifyFeature
IdentifyHtml
IdentifyText
IdentifyValue
NoCapabilities
Remove
Size
-
BuildPyramids
= 16¶
-
class
Capability
¶ Bases:
int
-
Create
= 4¶
-
Identify
= 32¶
-
IdentifyFeature
= 512¶
-
IdentifyHtml
= 256¶
-
IdentifyText
= 128¶
-
IdentifyValue
= 64¶
-
NoCapabilities
= 0¶
-
Remove
= 8¶
-
Size
= 2¶
-
bandCount
(self) → int¶ Get number of bands
-
bandStatistics
(self, bandNo: int, stats: int = QgsRasterBandStats.All, extent: QgsRectangle = QgsRectangle(), sampleSize: int = 0, feedback: QgsRasterBlockFeedback = None) → QgsRasterBandStats¶ Get band statistics.
Parameters: - bandNo – The band (number).
- stats – Requested statistics
- extent – Extent used to calc statistics, if empty, whole raster extent is used.
- sampleSize – Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample.
- feedback – optional feedback object
Returns: Band statistics.
-
block
(self, bandNo: int, extent: QgsRectangle, width: int, height: int, feedback: QgsRasterBlockFeedback = None) → QgsRasterBlock¶ Read block of data using given extent and size. Returns pointer to data. Caller is responsible to free the memory returned.
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.
-
capabilities
(self) → int¶ Returns a bitmask containing the supported capabilities
-
capabilitiesString
(self) → str¶ Returns the above in friendly format.
-
clone
(self) → QgsRasterInterface¶ Clone itself, create deep copy
-
cumulativeCut
(self, bandNo: int, lowerCount: float, upperCount: float, extent: QgsRectangle = QgsRectangle(), sampleSize: int = 0) → Tuple[float, float]¶ Find values for cumulative pixel count cut.
Parameters: - bandNo – The band (number).
- lowerCount – The lower count as fraction of 1, e.g. 0.02 = 2%
- upperCount – The upper count as fraction of 1, e.g. 0.98 = 98%
- lowerValue – Location into which the lower value will be set.
- upperValue – Location into which the upper value will be set.
- extent – Extent used to calc histogram, if empty, whole raster extent is used.
- sampleSize – Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample.
-
dataType
(self, bandNo: int) → Qgis.DataType¶ Returns data type for the band specified by number
-
dataTypeSize
(self, bandNo: int) → int¶
-
extent
(self) → QgsRectangle¶ Get the extent of the interface.
Returns: QgsRectangle containing the extent of the layer
-
generateBandName
(self, bandNumber: int) → str¶ helper function to create zero padded band names
-
hasHistogram
(self, bandNo: int, binCount: int, minimum: object = Py_None, maximum: object = Py_None, extent: QgsRectangle = QgsRectangle(), sampleSize: int = 0, includeOutOfRange: bool = False) → bool¶ Returns true if histogram is available (cached, already calculated)
Note
the parameters are the same as in
histogram()
-
hasStatistics
(self, bandNo: int, stats: int = QgsRasterBandStats.All, extent: QgsRectangle = QgsRectangle(), sampleSize: int = 0) → bool¶ Returns true if histogram is available (cached, already calculated). * The parameters are the same as in bandStatistics()
Returns: true if statistics are available (ready to use)
-
histogram
(self, bandNo: int, binCount: int = 0, minimum: object = Py_None, maximum: object = Py_None, extent: QgsRectangle = QgsRectangle(), sampleSize: int = 0, includeOutOfRange: bool = False, feedback: QgsRasterBlockFeedback = None) → QgsRasterHistogram¶ Get histogram. Histograms are cached in providers.
Parameters: - bandNo – The band (number).
- binCount – Number of bins (intervals,buckets). If 0, the number of bins is decided automatically according to data type, raster size etc.
- minimum – Minimum value, if NaN (None for Python), raster minimum value will be used.
- maximum – Maximum value, if NaN (None for Python), raster maximum value will be used.
- extent – Extent used to calc histogram, if empty, whole raster extent is used.
- sampleSize – Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample.
- includeOutOfRange – include out of range values
- feedback – optional feedback object
Returns: Vector of non NULL cell counts for each bin.
Note
binCount, minimum and maximum not optional in Python bindings
-
initHistogram
(self, histogram: QgsRasterHistogram, bandNo: int, binCount: int, minimum: object = Py_None, maximum: object = Py_None, boundingBox: QgsRectangle = QgsRectangle(), sampleSize: int = 0, includeOutOfRange: bool = False)¶ Fill in histogram defaults if not specified
Note
the parameters are the same as in
histogram()
-
initStatistics
(self, statistics: QgsRasterBandStats, bandNo: int, stats: int = QgsRasterBandStats.All, boundingBox: QgsRectangle = QgsRectangle(), binCount: int = 0)¶ Fill in statistics defaults if not specified
-
input
(self) → QgsRasterInterface¶ Current input
-
on
(self) → bool¶ Is on/off
-
readXml
(self, filterElem: QDomElement)¶ Sets base class members from xml. Usually called from create() methods of subclasses
-
setInput
(self, input: QgsRasterInterface) → bool¶ Set input. Returns true if set correctly, false if cannot use that input *
-
setOn
(self, on: bool)¶ Set on/off
-
sourceDataType
(self, bandNo: int) → Qgis.DataType¶ Returns source data type for the band specified by number, source data type may be shorter than dataType *
-
sourceInput
(self) → QgsRasterInterface¶ Get source / raw input, the first in pipe, usually provider. It may be used to get info about original data, e.g. resolution to decide resampling etc.
-
writeXml
(self, doc: QDomDocument, parentElem: QDomElement)¶ Write base class members to xml.
-
xBlockSize
(self) → int¶ Get block size
-
xSize
(self) → int¶ Get raster size
-
yBlockSize
(self) → int¶
-
ySize
(self) → int¶
-