/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/analysis/vector/qgszonalstatistics.h                             *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/







class QgsZonalStatistics
{
%Docstring(signature="appended")
A class that calculates raster statistics (count, sum, mean) for a
polygon or multipolygon layer and appends the results as attributes.
%End

%TypeHeaderCode
#include "qgszonalstatistics.h"
%End
  public:
    QgsZonalStatistics( QgsVectorLayer *polygonLayer, QgsRasterLayer *rasterLayer, const QString &attributePrefix = QString(), int rasterBand = 1, Qgis::ZonalStatistics stats = Qgis::ZonalStatistic::Default );
%Docstring
Convenience constructor for QgsZonalStatistics, using an input raster
layer.

The raster layer must exist for the lifetime of the zonal statistics
calculation.

.. warning::

   Constructing QgsZonalStatistics using this method is not thread safe, and
   the constructor which accepts a :py:class:`QgsRasterInterface` should be used instead.
%End

    QgsZonalStatistics( QgsVectorLayer *polygonLayer, QgsRasterInterface *rasterInterface, const QgsCoordinateReferenceSystem &rasterCrs, double rasterUnitsPerPixelX, double rasterUnitsPerPixelY, const QString &attributePrefix = QString(), int rasterBand = 1, Qgis::ZonalStatistics stats = Qgis::ZonalStatistic::Default );
%Docstring
Constructor for QgsZonalStatistics, using a QgsRasterInterface.

The ``polygonLayer`` gives the vector layer containing the
(multi)polygon features corresponding to the different zones. This layer
will be modified, adding extra attributes for each of the zonal
statistics calculated.

Pixel values for each zone are taken from the raster
``rasterInterface``. The constructor must also be given various
properties relating to the input raster, such as the raster CRS
(``rasterCrs``), and the size (X and Y) in map units for each raster
pixel. The source raster band is specified via ``rasterBand``, where a
value of 1 corresponds to the first band.

If the CRS of the ``polygonLayer`` and ``rasterCrs`` differ, the
calculation will automatically reproject the zones to ensure valid
results are calculated.

The ``attributePrefix`` argument specifies an optional prefix to use
when creating the new fields for each calculated statistic.

Finally, the calculated statistics can be set via the ``stats``
argument. A new field will be added to ``polygonLayer`` for each
statistic calculated.

.. warning::

   The raster interface must exist for the lifetime of the zonal statistics calculation. For thread
   safe use, always use a cloned raster interface.

.. versionadded:: 3.2
%End


    Qgis::ZonalStatisticResult calculateStatistics( QgsFeedback *feedback );
%Docstring
Runs the calculation.
%End

    static QString displayName( Qgis::ZonalStatistic statistic );
%Docstring
Returns the friendly display name for a ``statistic``.

.. seealso:: :py:func:`shortName`

.. versionadded:: 3.12
%End

    static QString shortName( Qgis::ZonalStatistic statistic );
%Docstring
Returns a short, friendly display name for a ``statistic``, suitable for
use in a field name.

.. seealso:: :py:func:`displayName`

.. versionadded:: 3.12
%End



    static QMap<int, QVariant> calculateStatisticsInt( QgsRasterInterface *rasterInterface, const QgsGeometry &geometry, double cellSizeX, double cellSizeY, int rasterBand, Qgis::ZonalStatistics statistics ) /PyName=calculateStatistics/;
%Docstring
Calculates the specified ``statistics`` for the pixels of ``rasterBand``
in ``rasterInterface`` (a raster layer
:py:func:`~QgsZonalStatistics.dataProvider` ) within polygon
``geometry``.

Returns a map of statistic to result value.

.. versionadded:: 3.16
%End

      public:
};


/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/analysis/vector/qgszonalstatistics.h                             *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/
