/
qgszonalstatistics.sip
42 lines (34 loc) · 1.46 KB
/
qgszonalstatistics.sip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/** \ingroup analysis
* The Qgis class that calculates raster statistics (count, sum, mean) for
* a polygon or multipolygon layer and appends the results as attributes
*/
class QgsZonalStatistics
{
%TypeHeaderCode
#include <qgszonalstatistics.h>
%End
public:
//! Enumeration of flags that specify statistics to be calculated
enum Statistic
{
Count, //!< Pixel count
Sum, //!< Sum of pixel values
Mean, //!< Mean of pixel values
Median, //!< Median of pixel values
StDev, //!< Standard deviation of pixel values
Min, //!< Min of pixel values
Max, //!< Max of pixel values
Range, //!< Range of pixel values (max - min)
Minority, //!< Minority of pixel values
Majority, //!< Majority of pixel values
Variety, //!< Variety (count of distinct) pixel values
All
};
typedef QFlags<QgsZonalStatistics::Statistic> Statistics;
QgsZonalStatistics( QgsVectorLayer* polygonLayer, QgsRasterLayer* rasterLayer, const QString& attributePrefix = "", int rasterBand = 1,
QgsZonalStatistics::Statistics stats = QgsZonalStatistics::Statistics( QgsZonalStatistics::Count | QgsZonalStatistics::Sum | QgsZonalStatistics::Mean) );
/** Starts the calculation
@return 0 in case of success*/
int calculateStatistics( QProgressDialog* p );
};
QFlags<QgsZonalStatistics::Statistic> operator|(QgsZonalStatistics::Statistic f1, QFlags<QgsZonalStatistics::Statistic> f2);