Class: QgsRasterInterface¶
-
class
qgis.core.
QgsRasterInterface
¶ Bases:
sip.wrapper
Base class for processing filters like renderers, reprojector, resampler etc.
Enums
Methods
Gets number of bands
Returns the band statistics.
Read block of data using given extent and size.
Returns a bitmask containing the supported capabilities
Returns the above in friendly format.
Clone itself, create deep copy
Find values for cumulative pixel count cut.
Returns data type for the band specified by number
Gets the extent of the interface.
helper function to create zero padded band names
Returns true if histogram is available (cached, already calculated)
Returns true if histogram is available (cached, already calculated).
Returns a band histogram.
Fill in histogram defaults if not specified
Fill in statistics defaults if not specified
Current input
Returns whether the interface is on or off
Sets base class members from xml.
Set input.
Sets whether the interface is on or off
Returns source data type for the band specified by number, source data type may be shorter than dataType *
Gets source / raw input, the first in pipe, usually provider.
Write base class members to xml.
Gets block size
Gets raster size
Signals
Attributes
-
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¶ Gets number of bands
-
bandStatistics
(self, bandNo: int, stats: int = QgsRasterBandStats.All, extent: QgsRectangle = QgsRectangle(), sampleSize: int = 0, feedback: QgsRasterBlockFeedback = None) → QgsRasterBandStats¶ Returns the 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
-
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 cancellation/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¶ Gets 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¶ Returns a band 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¶ Returns whether the interface is on or 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)¶ Sets whether the interface is on or 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¶ Gets 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¶ Gets block size
-
xSize
(self) → int¶ Gets raster size
-
yBlockSize
(self) → int¶
-
ySize
(self) → int¶
-