Navigation Menu

Skip to content

Commit

Permalink
add raster stats to python bindings (many more functions missing)
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennesky committed Aug 28, 2012
1 parent 126932f commit b9ae061
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
28 changes: 26 additions & 2 deletions python/core/qgsrasterdataprovider.sip
Expand Up @@ -79,8 +79,32 @@ class QgsRasterDataProvider : QgsDataProvider

// TODO: Get the file masks supported by this provider, suitable for feeding into the file open dialog box


/**
// TODO: add other missing bindings (histo, pyramids and others)

/** If the provider supports it, return band stats for the
given band. Default behaviour is to blockwise read the data
and generate the stats unless the provider overloads this function. */
//virtual QgsRasterBandStats bandStatistics( int theBandNo );

/** \brief Get band statistics.
* @param theBandNo The band (number).
* @param theStats Requested statistics
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
* @param theSampleSize 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.
* @return Band statistics.
*/
virtual QgsRasterBandStats bandStatistics( int theBandNo,
int theStats = QgsRasterBandStats::All,
const QgsRectangle & theExtent = QgsRectangle(),
int theSampleSize = 0 );

/** \brief Returns true if histogram is available (cached, already calculated), the parameters are the same as in histogram() */
virtual bool hasStatistics( int theBandNo,
int theStats = QgsRasterBandStats::All,
const QgsRectangle & theExtent = QgsRectangle(),
int theSampleSize = 0 );

/**
* Get metadata in a format suitable for feeding directly
* into a subset of the GUI raster properties "Metadata" tab.
*/
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsrasterlayer.sip
Expand Up @@ -96,7 +96,7 @@ public:
/** \brief A list containing one RasterBandStats struct per raster band in this raster layer.
* Note that while every RasterBandStats element will have the name and number of its associated
* band populated, any additional stats are calculated on a need to know basis.*/
typedef QList<QgsRasterBandStats> RasterStatsList;
// typedef QList<QgsRasterBandStats> RasterStatsList;



Expand Down

0 comments on commit b9ae061

Please sign in to comment.