QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsrasteranalysisutils.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasteranalysisutils.cpp
3  ---------------------
4  Date : June 2018
5  Copyright : (C) 2018 by Nyall Dawson
6  Email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgsrasteranalysisutils.h"
17 
18 #include "qgsfeedback.h"
19 #include "qgsrasterblock.h"
20 #include "qgsrasteriterator.h"
21 #include "qgsgeos.h"
23 #include <map>
24 #include <unordered_map>
25 #include <unordered_set>
26 #include <cmath>
28 
29 void QgsRasterAnalysisUtils::cellInfoForBBox( const QgsRectangle &rasterBBox, const QgsRectangle &featureBBox, double cellSizeX, double cellSizeY,
30  int &nCellsX, int &nCellsY, int rasterWidth, int rasterHeight, QgsRectangle &rasterBlockExtent )
31 {
32  //get intersecting bbox
33  QgsRectangle intersectBox = rasterBBox.intersect( featureBBox );
34  if ( intersectBox.isEmpty() )
35  {
36  nCellsX = 0;
37  nCellsY = 0;
38  rasterBlockExtent = QgsRectangle();
39  return;
40  }
41 
42  //get offset in pixels in x- and y- direction
43  int offsetX = static_cast< int >( std::floor( ( intersectBox.xMinimum() - rasterBBox.xMinimum() ) / cellSizeX ) );
44  int offsetY = static_cast< int >( std::floor( ( rasterBBox.yMaximum() - intersectBox.yMaximum() ) / cellSizeY ) );
45 
46  int maxColumn = static_cast< int >( std::floor( ( intersectBox.xMaximum() - rasterBBox.xMinimum() ) / cellSizeX ) ) + 1;
47  int maxRow = static_cast< int >( std::floor( ( rasterBBox.yMaximum() - intersectBox.yMinimum() ) / cellSizeY ) ) + 1;
48 
49  nCellsX = maxColumn - offsetX;
50  nCellsY = maxRow - offsetY;
51 
52  //avoid access to cells outside of the raster (may occur because of rounding)
53  nCellsX = std::min( offsetX + nCellsX, rasterWidth ) - offsetX;
54  nCellsY = std::min( offsetY + nCellsY, rasterHeight ) - offsetY;
55 
56  rasterBlockExtent = QgsRectangle( rasterBBox.xMinimum() + offsetX * cellSizeX,
57  rasterBBox.yMaximum() - offsetY * cellSizeY,
58  rasterBBox.xMinimum() + ( nCellsX + offsetX ) * cellSizeX,
59  rasterBBox.yMaximum() - ( nCellsY + offsetY ) * cellSizeY );
60 }
61 
62 void QgsRasterAnalysisUtils::statisticsFromMiddlePointTest( QgsRasterInterface *rasterInterface, int rasterBand, const QgsGeometry &poly, int nCellsX, int nCellsY, double cellSizeX, double cellSizeY, const QgsRectangle &rasterBBox, const std::function<void( double )> &addValue, bool skipNodata )
63 {
64  std::unique_ptr< QgsGeometryEngine > polyEngine( QgsGeometry::createGeometryEngine( poly.constGet( ) ) );
65  if ( !polyEngine )
66  {
67  return;
68  }
69  polyEngine->prepareGeometry();
70 
71  QgsRasterIterator iter( rasterInterface );
72  iter.startRasterRead( rasterBand, nCellsX, nCellsY, rasterBBox );
73 
74  std::unique_ptr< QgsRasterBlock > block;
75  int iterLeft = 0;
76  int iterTop = 0;
77  int iterCols = 0;
78  int iterRows = 0;
79  QgsRectangle blockExtent;
80  bool isNoData = false;
81  while ( iter.readNextRasterPart( rasterBand, iterCols, iterRows, block, iterLeft, iterTop, &blockExtent ) )
82  {
83  double cellCenterY = blockExtent.yMaximum() - 0.5 * cellSizeY;
84 
85  for ( int row = 0; row < iterRows; ++row )
86  {
87  double cellCenterX = blockExtent.xMinimum() + 0.5 * cellSizeX;
88  for ( int col = 0; col < iterCols; ++col )
89  {
90  const double pixelValue = block->valueAndNoData( row, col, isNoData );
91  if ( validPixel( pixelValue ) && ( !skipNodata || !isNoData ) )
92  {
93  QgsPoint cellCenter( cellCenterX, cellCenterY );
94  if ( polyEngine->contains( &cellCenter ) )
95  {
96  addValue( pixelValue );
97  }
98  }
99  cellCenterX += cellSizeX;
100  }
101  cellCenterY -= cellSizeY;
102  }
103  }
104 }
105 
106 void QgsRasterAnalysisUtils::statisticsFromPreciseIntersection( QgsRasterInterface *rasterInterface, int rasterBand, const QgsGeometry &poly, int nCellsX, int nCellsY, double cellSizeX, double cellSizeY, const QgsRectangle &rasterBBox, const std::function<void( double, double )> &addValue, bool skipNodata )
107 {
108  QgsGeometry pixelRectGeometry;
109 
110  double hCellSizeX = cellSizeX / 2.0;
111  double hCellSizeY = cellSizeY / 2.0;
112  double pixelArea = cellSizeX * cellSizeY;
113  double weight = 0;
114 
115  std::unique_ptr< QgsGeometryEngine > polyEngine( QgsGeometry::createGeometryEngine( poly.constGet( ) ) );
116  if ( !polyEngine )
117  {
118  return;
119  }
120  polyEngine->prepareGeometry();
121 
122  QgsRasterIterator iter( rasterInterface );
123  iter.startRasterRead( rasterBand, nCellsX, nCellsY, rasterBBox );
124 
125  std::unique_ptr< QgsRasterBlock > block;
126  int iterLeft = 0;
127  int iterTop = 0;
128  int iterCols = 0;
129  int iterRows = 0;
130  QgsRectangle blockExtent;
131  bool isNoData = false;
132  while ( iter.readNextRasterPart( rasterBand, iterCols, iterRows, block, iterLeft, iterTop, &blockExtent ) )
133  {
134  double currentY = blockExtent.yMaximum() - 0.5 * cellSizeY;
135  for ( int row = 0; row < iterRows; ++row )
136  {
137  double currentX = blockExtent.xMinimum() + 0.5 * cellSizeX;
138  for ( int col = 0; col < iterCols; ++col )
139  {
140  const double pixelValue = block->valueAndNoData( row, col, isNoData );
141  if ( validPixel( pixelValue ) && ( !skipNodata || !isNoData ) )
142  {
143  pixelRectGeometry = QgsGeometry::fromRect( QgsRectangle( currentX - hCellSizeX, currentY - hCellSizeY, currentX + hCellSizeX, currentY + hCellSizeY ) );
144  // GEOS intersects tests on prepared geometry is MAGNITUDES faster than calculating the intersection itself,
145  // so we first test to see if there IS an intersection before doing the actual calculation
146  if ( !pixelRectGeometry.isNull() && polyEngine->intersects( pixelRectGeometry.constGet() ) )
147  {
148  //intersection
149  QgsGeometry intersectGeometry = pixelRectGeometry.intersection( poly );
150  if ( !intersectGeometry.isEmpty() )
151  {
152  double intersectionArea = intersectGeometry.area();
153  if ( intersectionArea > 0.0 )
154  {
155  weight = intersectionArea / pixelArea;
156  addValue( pixelValue, weight );
157  }
158  }
159  }
160  }
161  currentX += cellSizeX;
162  }
163  currentY -= cellSizeY;
164  }
165  }
166 }
167 
168 bool QgsRasterAnalysisUtils::validPixel( double value )
169 {
170  return !std::isnan( value );
171 }
172 
173 void QgsRasterAnalysisUtils::mapToPixel( const double x, const double y, const QgsRectangle bounds, const double unitsPerPixelX, const double unitsPerPixelY, int &px, int &py )
174 {
175  px = trunc( ( x - bounds.xMinimum() ) / unitsPerPixelX );
176  py = trunc( ( y - bounds.yMaximum() ) / -unitsPerPixelY );
177 }
178 
179 void QgsRasterAnalysisUtils::pixelToMap( const int px, const int py, const QgsRectangle bounds, const double unitsPerPixelX, const double unitsPerPixelY, double &x, double &y )
180 {
181  x = bounds.xMinimum() + ( px + 0.5 ) * unitsPerPixelX;
182  y = bounds.yMaximum() - ( py + 0.5 ) * unitsPerPixelY;
183 }
184 
185 static QVector< QPair< QString, Qgis::DataType > > sDataTypes;
186 
187 void populateDataTypes()
188 {
189  if ( sDataTypes.empty() )
190  {
191  sDataTypes.append( qMakePair( QStringLiteral( "Byte" ), Qgis::Byte ) );
192  sDataTypes.append( qMakePair( QStringLiteral( "Int16" ), Qgis::Int16 ) );
193  sDataTypes.append( qMakePair( QStringLiteral( "UInt16" ), Qgis::UInt16 ) );
194  sDataTypes.append( qMakePair( QStringLiteral( "Int32" ), Qgis::Int32 ) );
195  sDataTypes.append( qMakePair( QStringLiteral( "UInt32" ), Qgis::UInt32 ) );
196  sDataTypes.append( qMakePair( QStringLiteral( "Float32" ), Qgis::Float32 ) );
197  sDataTypes.append( qMakePair( QStringLiteral( "Float64" ), Qgis::Float64 ) );
198  sDataTypes.append( qMakePair( QStringLiteral( "CInt16" ), Qgis::CInt16 ) );
199  sDataTypes.append( qMakePair( QStringLiteral( "CInt32" ), Qgis::CInt32 ) );
200  sDataTypes.append( qMakePair( QStringLiteral( "CFloat32" ), Qgis::CFloat32 ) );
201  sDataTypes.append( qMakePair( QStringLiteral( "CFloat64" ), Qgis::CFloat64 ) );
202  }
203 }
204 
205 std::unique_ptr<QgsProcessingParameterDefinition> QgsRasterAnalysisUtils::createRasterTypeParameter( const QString &name, const QString &description, Qgis::DataType defaultType )
206 {
207  populateDataTypes();
208 
209  QStringList names;
210  int defaultChoice = 0;
211  int i = 0;
212  for ( auto it = sDataTypes.constBegin(); it != sDataTypes.constEnd(); ++it )
213  {
214  names.append( it->first );
215  if ( it->second == defaultType )
216  defaultChoice = i;
217  i++;
218  }
219 
220  return qgis::make_unique< QgsProcessingParameterEnum >( name, description, names, false, defaultChoice );
221 }
222 
223 Qgis::DataType QgsRasterAnalysisUtils::rasterTypeChoiceToDataType( int choice )
224 {
225  if ( choice < 0 || choice >= sDataTypes.count() )
226  return Qgis::Float32;
227 
228  return sDataTypes.value( choice ).second;
229 }
230 
231 void QgsRasterAnalysisUtils::applyRasterLogicOperator( const std::vector< QgsRasterAnalysisUtils::RasterLogicInput > &inputs, QgsRasterDataProvider *destinationRaster, double outputNoDataValue, const bool treatNoDataAsFalse,
232  int width, int height, const QgsRectangle &extent, QgsFeedback *feedback,
233  std::function<void( const std::vector< std::unique_ptr< QgsRasterBlock > > &, bool &, bool &, int, int, bool )> &applyLogicFunc,
234  qgssize &noDataCount, qgssize &trueCount, qgssize &falseCount )
235 {
238  int nbBlocksWidth = static_cast< int>( std::ceil( 1.0 * width / maxWidth ) );
239  int nbBlocksHeight = static_cast< int >( std::ceil( 1.0 * height / maxHeight ) );
240  int nbBlocks = nbBlocksWidth * nbBlocksHeight;
241 
242  destinationRaster->setEditable( true );
243  QgsRasterIterator outputIter( destinationRaster );
244  outputIter.startRasterRead( 1, width, height, extent );
245 
246  int iterLeft = 0;
247  int iterTop = 0;
248  int iterCols = 0;
249  int iterRows = 0;
250  QgsRectangle blockExtent;
251  std::unique_ptr< QgsRasterBlock > outputBlock;
252  while ( outputIter.readNextRasterPart( 1, iterCols, iterRows, outputBlock, iterLeft, iterTop, &blockExtent ) )
253  {
254  std::vector< std::unique_ptr< QgsRasterBlock > > inputBlocks;
255  for ( const QgsRasterAnalysisUtils::RasterLogicInput &i : inputs )
256  {
257  for ( int band : i.bands )
258  {
259  std::unique_ptr< QgsRasterBlock > b( i.interface->block( band, blockExtent, iterCols, iterRows ) );
260  inputBlocks.emplace_back( std::move( b ) );
261  }
262  }
263 
264  feedback->setProgress( 100 * ( ( iterTop / maxHeight * nbBlocksWidth ) + iterLeft / maxWidth ) / nbBlocks );
265  for ( int row = 0; row < iterRows; row++ )
266  {
267  if ( feedback->isCanceled() )
268  break;
269 
270  for ( int column = 0; column < iterCols; column++ )
271  {
272  bool res = false;
273  bool resIsNoData = false;
274  applyLogicFunc( inputBlocks, res, resIsNoData, row, column, treatNoDataAsFalse );
275  if ( resIsNoData )
276  noDataCount++;
277  else if ( res )
278  trueCount++;
279  else
280  falseCount++;
281 
282  outputBlock->setValue( row, column, resIsNoData ? outputNoDataValue : ( res ? 1 : 0 ) );
283  }
284  }
285  destinationRaster->writeBlock( outputBlock.get(), 1, iterLeft, iterTop );
286  }
287  destinationRaster->setEditable( false );
288 }
289 
290 std::vector<double> QgsRasterAnalysisUtils::getCellValuesFromBlockStack( const std::vector< std::unique_ptr< QgsRasterBlock > > &inputBlocks, int &row, int &col, bool &noDataInStack )
291 {
292  //get all values from inputBlocks
293  std::vector<double> cellValues;
294  bool hasNoData = false;
295  cellValues.reserve( inputBlocks.size() );
296 
297  for ( auto &block : inputBlocks )
298  {
299  double value = 0;
300  if ( !block || !block->isValid() )
301  {
302  noDataInStack = true;
303  break;
304  }
305  else
306  {
307  value = block->valueAndNoData( row, col, hasNoData );
308  if ( hasNoData )
309  {
310  noDataInStack = true;
311  continue; //NoData is not included in the cell value vector
312  }
313  else
314  {
315  cellValues.push_back( value );
316  }
317  }
318  }
319  return cellValues;
320 }
321 
322 double QgsRasterAnalysisUtils::meanFromCellValues( std::vector<double> cellValues, int stackSize )
323 {
324  double sum = std::accumulate( cellValues.begin(), cellValues.end(), 0.0 );
325  double mean = sum / static_cast<double>( stackSize );
326  return mean;
327 }
328 
329 double QgsRasterAnalysisUtils::medianFromCellValues( std::vector<double> cellValues, int stackSize )
330 {
331  std::sort( cellValues.begin(), cellValues.end() );
332  int medianElementIdx = stackSize / 2;
333  if ( stackSize % 2 == 0 )
334  {
335  return ( cellValues[medianElementIdx] + cellValues[medianElementIdx + 1] ) / 2.0;
336  }
337  else
338  {
339  return cellValues[medianElementIdx];
340  }
341 }
342 
343 
344 double QgsRasterAnalysisUtils::stddevFromCellValues( std::vector<double> cellValues, int stackSize )
345 {
346  double variance = varianceFromCellValues( cellValues, stackSize );
347  double stddev = std::sqrt( variance );
348  return stddev;
349 }
350 
351 double QgsRasterAnalysisUtils::varianceFromCellValues( std::vector<double> cellValues, int stackSize )
352 {
353  double mean = meanFromCellValues( cellValues, stackSize );
354  double accum = 0.0;
355  for ( int i = 0; i < stackSize; i++ )
356  {
357  accum += std::pow( ( cellValues.at( i ) - mean ), 2.0 );
358  }
359  double variance = accum / static_cast<double>( stackSize );
360  return variance;
361 }
362 
363 double QgsRasterAnalysisUtils::maximumFromCellValues( std::vector<double> cellValues )
364 {
365  return *std::max_element( cellValues.begin(), cellValues.end() );
366 }
367 
368 double QgsRasterAnalysisUtils::minimumFromCellValues( std::vector<double> cellValues )
369 {
370  return *std::min_element( cellValues.begin(), cellValues.end() );
371 }
372 
373 double QgsRasterAnalysisUtils::majorityFromCellValues( std::vector<double> cellValues, const double noDataValue, int stackSize )
374 {
375  if ( stackSize == 1 )
376  {
377  //output will be same as input if only one layer is entered
378  return cellValues[0];
379  }
380  else if ( stackSize == 2 )
381  {
382  //if only two layers are input, return NoData if values are not the same (eg. no Majority could be found)
383  return ( qgsDoubleNear( cellValues[0], cellValues[1] ) ) ? cellValues[0] : noDataValue;
384  }
385  else if ( std::adjacent_find( cellValues.begin(), cellValues.end(), std::not_equal_to<double>() ) == cellValues.end() )
386  {
387  //check if all values in cellValues are equal
388  //output will be same as input if all cellValues of the stack are the same
389  return cellValues[0];
390  }
391  else
392  {
393  //search for majority using hash map [O(n)]
394  std::unordered_map<double, int> map;
395 
396  for ( int i = 0; i < stackSize; i++ )
397  {
398  map[cellValues[i]]++;
399  }
400 
401  int maxCount = 0;
402  bool multipleMajorities = false;
403  double result = noDataValue;
404  for ( auto pair : map )
405  {
406  if ( maxCount < pair.second )
407  {
408  result = pair.first;
409  maxCount = pair.second;
410  multipleMajorities = false;
411  }
412  else if ( maxCount == pair.second )
413  {
414  multipleMajorities = true;
415  }
416  }
417  return multipleMajorities ? noDataValue : result;
418  }
419 }
420 
421 double QgsRasterAnalysisUtils::minorityFromCellValues( std::vector<double> cellValues, const double noDataValue, int stackSize )
422 {
423  if ( stackSize == 1 )
424  {
425  //output will be same as input if only one layer is entered
426  return cellValues[0];
427  }
428  else if ( stackSize == 2 )
429  {
430  //if only two layers are input, return NoData if values are not the same (eg. no minority could be found)
431  return ( qgsDoubleNear( cellValues[0], cellValues[1] ) ) ? cellValues[0] : noDataValue;
432  }
433  else if ( std::adjacent_find( cellValues.begin(), cellValues.end(), std::not_equal_to<double>() ) == cellValues.end() )
434  {
435  //check if all values in cellValues are equal
436  //output will be same as input if all cellValues of the stack are the same
437  return cellValues[0];
438  }
439  else
440  {
441  //search for minority using hash map [O(n)]
442  std::unordered_map<double, int> map;
443 
444  for ( int i = 0; i < stackSize; i++ )
445  {
446  map[cellValues[i]]++;
447  }
448 
449  int minCount = stackSize;
450  bool multipleMinorities = false;
451  double result = noDataValue; //result will stay NoData if no minority value exists
452  for ( auto pair : map )
453  {
454  if ( minCount > pair.second )
455  {
456  result = pair.first;
457  minCount = pair.second;
458  multipleMinorities = false;
459  }
460  else if ( minCount == pair.second )
461  {
462  multipleMinorities = true;
463  }
464  }
465  return multipleMinorities ? noDataValue : result;
466  }
467 }
468 
469 double QgsRasterAnalysisUtils::rangeFromCellValues( std::vector<double> cellValues )
470 {
471  double max = *std::max_element( cellValues.begin(), cellValues.end() );
472  double min = *std::min_element( cellValues.begin(), cellValues.end() );
473  return max - min;
474 }
475 
476 double QgsRasterAnalysisUtils::varietyFromCellValues( std::vector<double> cellValues )
477 {
478  std::unordered_set<double> uniqueValues( cellValues.begin(), cellValues.end() );
479  return uniqueValues.size();
480 }
481 
482 
484 
QgsFeedback::setProgress
void setProgress(double progress)
Sets the current progress for the feedback object.
Definition: qgsfeedback.h:62
Qgis::Float32
@ Float32
Thirty two bit floating point (float)
Definition: qgis.h:109
Qgis::DataType
DataType
Raster data types.
Definition: qgis.h:102
Qgis::UInt32
@ UInt32
Thirty two bit unsigned integer (quint32)
Definition: qgis.h:107
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:38
QgsGeometry::isNull
Q_GADGET bool isNull
Definition: qgsgeometry.h:126
QgsRectangle::yMinimum
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
Definition: qgsrectangle.h:177
QgsRasterDataProvider::setEditable
virtual bool setEditable(bool enabled)
Turns on/off editing mode of the provider.
Definition: qgsrasterdataprovider.h:451
qgsrasteranalysisutils.h
QgsRectangle::intersect
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
Definition: qgsrectangle.h:312
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Qgis::CFloat32
@ CFloat32
Complex Float32.
Definition: qgis.h:113
QgsGeometry::intersection
QgsGeometry intersection(const QgsGeometry &geometry) const
Returns a geometry representing the points shared by this geometry and other.
Definition: qgsgeometry.cpp:2380
qgsrasteriterator.h
QgsRectangle::xMaximum
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
Definition: qgsrectangle.h:162
Qgis::CFloat64
@ CFloat64
Complex Float64.
Definition: qgis.h:114
Qgis::CInt16
@ CInt16
Complex Int16.
Definition: qgis.h:111
qgsrasterblock.h
QgsRasterDataProvider::writeBlock
bool writeBlock(QgsRasterBlock *block, int band, int xOffset=0, int yOffset=0)
Writes pixel data from a raster block into the provider data source.
Definition: qgsrasterdataprovider.cpp:353
qgsDoubleNear
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition: qgis.h:315
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:44
QgsRasterIterator::DEFAULT_MAXIMUM_TILE_HEIGHT
static const int DEFAULT_MAXIMUM_TILE_HEIGHT
Default maximum tile height.
Definition: qgsrasteriterator.h:151
QgsGeometry::isEmpty
bool isEmpty() const
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geom...
Definition: qgsgeometry.cpp:367
QgsRectangle::xMinimum
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
Definition: qgsrectangle.h:167
QgsRasterIterator
Iterator for sequentially processing raster cells.
Definition: qgsrasteriterator.h:35
Qgis::UInt16
@ UInt16
Sixteen bit unsigned integer (quint16)
Definition: qgis.h:105
QgsGeometry::constGet
const QgsAbstractGeometry * constGet() const SIP_HOLDGIL
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
Definition: qgsgeometry.cpp:128
QgsFeedback::isCanceled
bool isCanceled() const
Tells whether the operation has been canceled already.
Definition: qgsfeedback.h:53
qgsprocessingparameters.h
QgsGeometry::createGeometryEngine
static QgsGeometryEngine * createGeometryEngine(const QgsAbstractGeometry *geometry)
Creates and returns a new geometry engine.
Definition: qgsgeometry.cpp:3636
QgsRasterInterface
Base class for processing filters like renderers, reprojector, resampler etc.
Definition: qgsrasterinterface.h:117
QgsRectangle::yMaximum
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
Definition: qgsrectangle.h:172
QgsGeometry
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
QgsGeometry::fromRect
static QgsGeometry fromRect(const QgsRectangle &rect) SIP_HOLDGIL
Creates a new geometry from a QgsRectangle.
Definition: qgsgeometry.cpp:229
QgsRasterIterator::DEFAULT_MAXIMUM_TILE_WIDTH
static const int DEFAULT_MAXIMUM_TILE_WIDTH
Default maximum tile width.
Definition: qgsrasteriterator.h:148
Qgis::Int16
@ Int16
Sixteen bit signed integer (qint16)
Definition: qgis.h:106
Qgis::Int32
@ Int32
Thirty two bit signed integer (qint32)
Definition: qgis.h:108
Qgis::CInt32
@ CInt32
Complex Int32.
Definition: qgis.h:112
Qgis::Byte
@ Byte
Eight bit unsigned integer (quint8)
Definition: qgis.h:104
qgsfeedback.h
QgsRectangle::isEmpty
bool isEmpty() const
Returns true if the rectangle is empty.
Definition: qgsrectangle.h:437
QgsGeometry::area
double area() const
Returns the planar, 2-dimensional area of the geometry.
Definition: qgsgeometry.cpp:1760
QgsRasterDataProvider
Base class for raster data providers.
Definition: qgsrasterdataprovider.h:89
qgsgeos.h
qgssize
unsigned long long qgssize
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...
Definition: qgis.h:768
Qgis::Float64
@ Float64
Sixty four bit floating point (double)
Definition: qgis.h:110