Subgroup: other

Class: QgsZonalStatistics

class qgis.analysis.QgsZonalStatistics(polygonLayer: QgsVectorLayer, rasterLayer: QgsRasterLayer, attributePrefix: str = '', rasterBand: int = 1, stats: Union[QgsZonalStatistics.Statistics, QgsZonalStatistics.Statistic] = QgsZonalStatistics.Statistics(QgsZonalStatistics.Count|QgsZonalStatistics.Sum|QgsZonalStatistics.Mean))

Bases: sip.wrapper

Constructor for QgsZonalStatistics.

QgsZonalStatistics(QgsZonalStatistics)

A class that calculates raster statistics (count, sum, mean) for a polygon or multipolygon layer and appends the results as attributes*

Methods

calculateStatistics Starts the calculation

Signals

Attributes

All
Count
Majority
Max
Mean
Median
Min
Minority
Range
StDev
Sum
Variance
Variety
All = 4095
Count = 1
Majority = 512
Max = 64
Mean = 4
Median = 8
Min = 32
Minority = 256
Range = 128
StDev = 16
class Statistic

Bases: int

class Statistics

Bases: sip.wrapper

QgsZonalStatistics.Statistics(Union[QgsZonalStatistics.Statistics, QgsZonalStatistics.Statistic]) QgsZonalStatistics.Statistics(QgsZonalStatistics.Statistics)

Sum = 2
Variance = 2048
Variety = 1024
calculateStatistics(self, feedback: QgsFeedback) → int

Starts the calculation

Returns:0 in case of success*