34#define ERR(message) QgsError(message, "Raster provider") 
   54  QgsDebugMsgLevel( QStringLiteral( 
"bandNo = %1 width = %2 height = %3" ).arg( bandNo ).arg( width ).arg( height ), 4 );
 
   57  std::unique_ptr< QgsRasterBlock > 
block = std::make_unique< QgsRasterBlock >( 
dataType( bandNo ), width, height );
 
   65    QgsDebugError( QStringLiteral( 
"Couldn't create raster block" ) );
 
   66    block->
setError( { tr( 
"Couldn't create raster block." ), QStringLiteral( 
"Raster" ) } );
 
   68    return block.release();
 
   76    QgsDebugError( QStringLiteral( 
"Extent outside provider extent" ) );
 
   77    block->
setError( { tr( 
"Extent outside provider extent." ), QStringLiteral( 
"Raster" ) } );
 
   80    return block.release();
 
   83  const double xRes = boundingBox.
width() / width;
 
   84  const double yRes = boundingBox.
height() / height;
 
   85  double tmpXRes, tmpYRes;
 
   86  double providerXRes = 0;
 
   87  double providerYRes = 0;
 
   92    tmpXRes = std::max( providerXRes, xRes );
 
   93    tmpYRes = std::max( providerYRes, yRes );
 
  103  if ( tmpExtent != boundingBox ||
 
  104       tmpXRes > xRes || tmpYRes > yRes )
 
  108    if ( !
extent().contains( boundingBox ) )
 
  115    const int fromRow = std::round( ( boundingBox.
yMaximum() - tmpExtent.
yMaximum() ) / yRes );
 
  116    const int toRow = std::round( ( boundingBox.
yMaximum() - tmpExtent.
yMinimum() ) / yRes ) - 1;
 
  117    const int fromCol = std::round( ( tmpExtent.
xMinimum() - boundingBox.
xMinimum() ) / xRes );
 
  118    const int toCol = std::round( ( tmpExtent.
xMaximum() - boundingBox.
xMinimum() ) / xRes ) - 1;
 
  120    QgsDebugMsgLevel( QStringLiteral( 
"fromRow = %1 toRow = %2 fromCol = %3 toCol = %4" ).arg( fromRow ).arg( toRow ).arg( fromCol ).arg( toCol ), 4 );
 
  122    if ( fromRow < 0 || fromRow >= height || toRow < 0 || toRow >= height ||
 
  123         fromCol < 0 || fromCol >= width || toCol < 0 || toCol >= width )
 
  126      QgsDebugError( QStringLiteral( 
"Row or column limits out of range" ) );
 
  127      block->
setError( { tr( 
"Row or column limits out of range" ), QStringLiteral( 
"Raster" ) } );
 
  129      return block.release();
 
  134    if ( tmpXRes > xRes )
 
  136      int col = std::floor( ( tmpExtent.
xMinimum() - 
extent().xMinimum() ) / providerXRes );
 
  138      col = std::ceil( ( tmpExtent.
xMaximum() - 
extent().xMinimum() ) / providerXRes );
 
  141    if ( tmpYRes > yRes )
 
  143      int row = std::floor( ( 
extent().yMaximum() - tmpExtent.
yMaximum() ) / providerYRes );
 
  145      row = std::ceil( ( 
extent().yMaximum() - tmpExtent.
yMinimum() ) / providerYRes );
 
  148    const int tmpWidth = std::round( tmpExtent.
width() / tmpXRes );
 
  149    const int tmpHeight = std::round( tmpExtent.
height() / tmpYRes );
 
  150    tmpXRes = tmpExtent.
width() / tmpWidth;
 
  151    tmpYRes = tmpExtent.
height() / tmpHeight;
 
  153    QgsDebugMsgLevel( QStringLiteral( 
"Reading smaller block tmpWidth = %1 height = %2" ).arg( tmpWidth ).arg( tmpHeight ), 4 );
 
  156    std::unique_ptr< QgsRasterBlock > tmpBlock = std::make_unique< QgsRasterBlock >( 
dataType( bandNo ), tmpWidth, tmpHeight );
 
  162    if ( !
readBlock( bandNo, tmpExtent, tmpWidth, tmpHeight, tmpBlock->bits(), feedback ) )
 
  164      QgsDebugError( QStringLiteral( 
"Error occurred while reading block" ) );
 
  165      block->
setError( { tr( 
"Error occurred while reading block." ), QStringLiteral( 
"Raster" ) } );
 
  168      return block.release();
 
  173    const double xMin = boundingBox.
xMinimum();
 
  174    const double yMax = boundingBox.
yMaximum();
 
  175    const double tmpXMin = tmpExtent.
xMinimum();
 
  176    const double tmpYMax = tmpExtent.
yMaximum();
 
  178    for ( 
int row = fromRow; row <= toRow; row++ )
 
  180      const double y = yMax - ( row + 0.5 ) * yRes;
 
  181      const int tmpRow = std::floor( ( tmpYMax - y ) / tmpYRes );
 
  183      for ( 
int col = fromCol; col <= toCol; col++ )
 
  185        const double x = xMin + ( col + 0.5 ) * xRes;
 
  186        const int tmpCol = std::floor( ( x - tmpXMin ) / tmpXRes );
 
  188        if ( tmpRow < 0 || tmpRow >= tmpHeight || tmpCol < 0 || tmpCol >= tmpWidth )
 
  190          QgsDebugError( QStringLiteral( 
"Source row or column limits out of range" ) );
 
  192          block->
setError( { tr( 
"Source row or column limits out of range." ), QStringLiteral( 
"Raster" ) } );
 
  194          return block.release();
 
  197        const qgssize tmpIndex = 
static_cast< qgssize >( tmpRow ) * 
static_cast< qgssize >( tmpWidth ) + tmpCol;
 
  198        const qgssize index = row * 
static_cast< qgssize >( width ) + col;
 
  200        const char *tmpBits = tmpBlock->
constBits( tmpIndex );
 
  204          QgsDebugError( QStringLiteral( 
"Cannot get input block data tmpRow = %1 tmpCol = %2 tmpIndex = %3." ).arg( tmpRow ).arg( tmpCol ).arg( tmpIndex ) );
 
  209          QgsDebugError( QStringLiteral( 
"Cannot set output block data." ) );
 
  212        memcpy( bits, tmpBits, pixelSize );
 
  220      QgsDebugError( QStringLiteral( 
"Error occurred while reading block" ) );
 
  222      block->
setError( { tr( 
"Error occurred while reading block." ), QStringLiteral( 
"Raster" ) } );
 
  224      return block.release();
 
  232  return block.release();
 
 
  276  QMap<int, QVariant> results;
 
  284  if ( !
extent().contains( point ) )
 
  287    for ( 
int bandNo = 1; bandNo <= 
bandCount(); bandNo++ )
 
  289      results.insert( bandNo, QVariant() );
 
  308  const double xres = ( finalExtent.
width() ) / width;
 
  309  const double yres = ( finalExtent.
height() ) / height;
 
  311  const int col = 
static_cast< int >( std::floor( ( point.
x() - finalExtent.
xMinimum() ) / xres ) );
 
  312  const int row = 
static_cast< int >( std::floor( ( finalExtent.
yMaximum() - point.
y() ) / yres ) );
 
  314  const double xMin = finalExtent.
xMinimum() + col * xres;
 
  315  const double xMax = xMin + xres;
 
  316  const double yMax = finalExtent.
yMaximum() - row * yres;
 
  317  const double yMin = yMax - yres;
 
  318  const QgsRectangle pixelExtent( xMin, yMin, xMax, yMax );
 
  320  for ( 
int bandNumber = 1; bandNumber <= 
bandCount(); bandNumber++ )
 
  322    std::unique_ptr< QgsRasterBlock > bandBlock( 
block( bandNumber, pixelExtent, 1, 1 ) );
 
  326      const double value = bandBlock->value( 0 );
 
  327      results.insert( bandNumber, value );
 
  331      results.insert( bandNumber, QVariant() );
 
 
  338                                      bool *ok, 
const QgsRectangle &boundingBox, 
int width, 
int height, 
int dpi )
 
  346  const QVariant value = res.results().value( band );
 
  348  if ( !value.isValid() )
 
  349    return std::numeric_limits<double>::quiet_NaN();
 
  354  return value.toDouble( ok );
 
 
  361  return QStringLiteral( 
"text/plain" );
 
 
  372    QgsDebugError( QStringLiteral( 
"writeBlock() called on read-only provider." ) );
 
 
  382  if ( methods.isEmpty() )
 
  384    QgsDebugMsgLevel( QStringLiteral( 
"provider pyramidResamplingMethods returned no methods" ), 2 );
 
 
  394  return std::any_of( pyramidList.constBegin(), pyramidList.constEnd(), []( 
QgsRasterPyramid pyramid ) { return pyramid.getExists(); } );
 
 
  408  QgsDebugMsgLevel( QStringLiteral( 
"set %1 band %1 no data ranges" ).arg( noData.size() ), 4 );
 
  415      return stats.bandNumber == bandNo;
 
  419      return histogram.bandNumber == bandNo;
 
 
  429  return mTemporalCapabilities.get();
 
 
  436  return mTemporalCapabilities.get();
 
 
  443  return mElevationProperties.get();
 
 
  450  return mElevationProperties.get();
 
 
  455    const QString &format, 
int nBands,
 
  457    int width, 
int height, 
double *geoTransform,
 
  459    const QStringList &createOptions )
 
  465                                 height, geoTransform, 
crs, createOptions );
 
  468    QgsDebugError( 
"Cannot resolve 'createRasterDataProviderFunction' function in " + providerKey + 
" provider" );
 
 
  482      return QStringLiteral( 
"Value" );
 
  484      return QStringLiteral( 
"Text" );
 
  486      return QStringLiteral( 
"Html" );
 
  488      return QStringLiteral( 
"Feature" );
 
  492  return QStringLiteral( 
"Undefined" );
 
 
  500      return tr( 
"Value" );
 
  506      return tr( 
"Feature" );
 
  510  return QStringLiteral( 
"Undefined" );
 
 
  515  if ( formatName == QLatin1String( 
"Value" ) )
 
  517  if ( formatName == QLatin1String( 
"Text" ) )
 
  519  if ( formatName == QLatin1String( 
"Html" ) )
 
  521  if ( formatName == QLatin1String( 
"Feature" ) )
 
 
  548  return QList< double >();
 
 
  590  if ( mTemporalCapabilities && other.mTemporalCapabilities )
 
  592    *mTemporalCapabilities = *other.mTemporalCapabilities;
 
  594  if ( mElevationProperties && other.mElevationProperties )
 
  596    *mElevationProperties = *other.mElevationProperties;
 
 
  602  if ( 
str == QLatin1String( 
"bilinear" ) )
 
  606  else if ( 
str == QLatin1String( 
"cubic" ) )
 
  610  else if ( 
str == QLatin1String( 
"cubicSpline" ) )
 
  614  else if ( 
str == QLatin1String( 
"lanczos" ) )
 
  618  else if ( 
str == QLatin1String( 
"average" ) )
 
  622  else if ( 
str == QLatin1String( 
"mode" ) )
 
  626  else if ( 
str == QLatin1String( 
"gauss" ) )
 
  637  if ( filterElem.isNull() )
 
  642  const QDomElement resamplingElement = filterElem.firstChildElement( QStringLiteral( 
"resampling" ) );
 
  643  if ( !resamplingElement.isNull() )
 
  645    setMaxOversampling( resamplingElement.attribute( QStringLiteral( 
"maxOversampling" ), QStringLiteral( 
"2.0" ) ).toDouble() );
 
  646    setZoomedInResamplingMethod( resamplingMethodFromString( resamplingElement.attribute( QStringLiteral( 
"zoomedInResamplingMethod" ) ) ) );
 
  647    setZoomedOutResamplingMethod( resamplingMethodFromString( resamplingElement.attribute( QStringLiteral( 
"zoomedOutResamplingMethod" ) ) ) );
 
 
  657      return QStringLiteral( 
"nearestNeighbour" );
 
  659      return QStringLiteral( 
"bilinear" );
 
  661      return QStringLiteral( 
"cubic" );
 
  663      return QStringLiteral( 
"cubicSpline" );
 
  665      return QStringLiteral( 
"lanczos" );
 
  667      return QStringLiteral( 
"average" );
 
  669      return QStringLiteral( 
"mode" );
 
  671      return QStringLiteral( 
"gauss" );
 
  674  return QStringLiteral( 
"nearestNeighbour" );
 
  681  QDomElement providerElement = doc.createElement( QStringLiteral( 
"provider" ) );
 
  682  parentElem.appendChild( providerElement );
 
  684  QDomElement resamplingElement = doc.createElement( QStringLiteral( 
"resampling" ) );
 
  685  providerElement.appendChild( resamplingElement );
 
  687  resamplingElement.setAttribute( QStringLiteral( 
"enabled" ),
 
  690  resamplingElement.setAttribute( QStringLiteral( 
"zoomedInResamplingMethod" ),
 
  693  resamplingElement.setAttribute( QStringLiteral( 
"zoomedOutResamplingMethod" ),
 
  696  resamplingElement.setAttribute( QStringLiteral( 
"maxOversampling" ),
 
 
  706    return mAttributeTables.at( bandNumber ).get();
 
  708  catch ( std::out_of_range 
const & )
 
 
  720    mAttributeTables[ bandNumber ] = std::unique_ptr<QgsRasterAttributeTable>( 
attributeTable );
 
 
  732  if ( mAttributeTables.find( bandNumber ) != std::end( mAttributeTables ) )
 
  734    mAttributeTables.erase( bandNumber );
 
 
  747      *errorMessage = QObject::tr( 
"Raster has no Raster Attribute Table for band %1" ).arg( bandNumber );
 
 
  761    *errorMessage = QObject::tr( 
"Raster data provider has no native Raster Attribute Table support." );
 
 
  768  Q_UNUSED( bandNumber )
 
 
  776  std::unique_ptr<QgsRasterAttributeTable> rat = std::make_unique<QgsRasterAttributeTable>();
 
  777  if ( rat->readFromFile( path, errorMessage ) )
 
 
  792  Q_UNUSED( errorMessage );
 
 
  805  QUrl url = QUrl::fromPercentEncoding( 
uri.toUtf8() );
 
  806  const QUrlQuery query( url.query() );
 
  809  if ( ! query.hasQueryItem( QStringLiteral( 
"crs" ) ) )
 
  812    if ( ok ) *ok = 
false;
 
  815  if ( ! components.
crs.
createFromString( query.queryItemValue( QStringLiteral( 
"crs" ) ) ) )
 
  818    if ( ok ) *ok = 
false;
 
  823  if ( ! query.hasQueryItem( QStringLiteral( 
"extent" ) ) )
 
  826    if ( ok ) *ok = 
false;
 
  829  QStringList pointValuesList = query.queryItemValue( QStringLiteral( 
"extent" ) ).split( 
',' );
 
  830  if ( pointValuesList.size() != 4 )
 
  833    if ( ok ) *ok = 
false;
 
  836  components.
extent = 
QgsRectangle( pointValuesList.at( 0 ).toDouble(), pointValuesList.at( 1 ).toDouble(),
 
  837                                    pointValuesList.at( 2 ).toDouble(), pointValuesList.at( 3 ).toDouble() );
 
  839  if ( ! query.hasQueryItem( QStringLiteral( 
"width" ) ) )
 
  842    if ( ok ) *ok = 
false;
 
  846  components.
width = query.queryItemValue( QStringLiteral( 
"width" ) ).toInt( & flagW );
 
  847  if ( !flagW ||  components.
width < 0 )
 
  850    if ( ok ) *ok = 
false;
 
  854  if ( ! query.hasQueryItem( QStringLiteral( 
"height" ) ) )
 
  857    if ( ok ) *ok = 
false;
 
  861  components.
height = query.queryItemValue( QStringLiteral( 
"height" ) ).toInt( & flagH );
 
  862  if ( !flagH ||  components.
height < 0 )
 
  865    if ( ok ) *ok = 
false;
 
  869  if ( ! query.hasQueryItem( QStringLiteral( 
"formula" ) ) )
 
  872    if ( ok ) *ok = 
false;
 
  875  components.
formula = query.queryItemValue( QStringLiteral( 
"formula" ) );
 
  877  for ( 
const auto &item : query.queryItems() )
 
  879    if ( !( item.first.mid( item.first.indexOf( 
':' ), -1 ) == QLatin1String( 
":uri" ) ) )
 
  885    rLayer.
name = item.first.mid( 0, item.first.indexOf( 
':' ) );
 
  886    rLayer.
uri = query.queryItemValue( item.first );
 
  887    rLayer.
provider = query.queryItemValue( item.first.mid( 0, item.first.indexOf( 
':' ) ) + QStringLiteral( 
":provider" ) );
 
  889    if ( rLayer.
uri.isNull() || rLayer.
provider.isNull() )
 
  891      QgsDebugError( 
"One or more raster information are missing" );
 
  892      if ( ok ) *ok = 
false;
 
  900  if ( ok ) *ok = 
true;
 
 
  911    query.addQueryItem( QStringLiteral( 
"crs" ), parts.
crs.
authid() );
 
  919    query.addQueryItem( QStringLiteral( 
"extent" ), rect );
 
  922  query.addQueryItem( QStringLiteral( 
"width" ), QString::number( parts.
width ) );
 
  924  query.addQueryItem( QStringLiteral( 
"height" ), QString::number( parts.
height ) );
 
  926  query.addQueryItem( QStringLiteral( 
"formula" ), parts.
formula );
 
  932      query.addQueryItem( it.name + QStringLiteral( 
":uri" ), it.uri );
 
  933      query.addQueryItem( it.name + QStringLiteral( 
":provider" ), it.provider );
 
  936  uri.setQuery( query );
 
  937  return QString( QUrl::toPercentEncoding( 
uri.toEncoded() ) );
 
 
QFlags< RasterProviderCapability > RasterProviderCapabilities
Raster data provider capabilities.
 
@ NoProviderCapabilities
Provider has no capabilities.
 
RasterInterfaceCapability
Raster interface capabilities.
 
@ NoCapabilities
No capabilities.
 
@ Size
Original data source size (and thus resolution) is known, it is not always available,...
 
@ IdentifyValue
Numerical values.
 
@ IdentifyFeature
WMS GML -> feature.
 
DataType
Raster data types.
 
RasterColorInterpretation
Raster color interpretation.
 
RasterIdentifyFormat
Raster identify formats.
 
@ Feature
WMS GML/JSON -> feature.
 
@ Value
Numerical pixel value.
 
This class represents a coordinate reference system (CRS).
 
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
 
bool createFromString(const QString &definition)
Set up this CRS from a string definition.
 
Abstract base class for spatial data provider implementations.
 
virtual QgsCoordinateReferenceSystem crs() const =0
Returns the coordinate system for the data source.
 
QFlags< ReadFlag > ReadFlags
 
QgsDataSourceUri uri() const
Gets the data source specification.
 
A class to represent a 2D point.
 
Point geometry type, with support for z-dimension and m-values.
 
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
 
QgsRasterDataProvider * createRasterDataProvider(const QString &providerKey, const QString &uri, const QString &format, int nBands, Qgis::DataType type, int width, int height, double *geoTransform, const QgsCoordinateReferenceSystem &crs, const QStringList &createOptions=QStringList())
Creates new instance of raster data provider.
 
QList< QPair< QString, QString > > pyramidResamplingMethods(const QString &providerKey)
Returns list of raster pyramid resampling methods.
 
The QgsRasterAttributeTable class represents a Raster Attribute Table (RAT).
 
bool writeToFile(const QString &path, QString *errorMessage=nullptr)
Writes the Raster Attribute Table to a DBF file specified by path, optionally reporting any error in ...
 
The RasterBandStats struct is a container for statistics about a single raster band.
 
Feedback object tailored for raster block reading.
 
bool isEmpty() const
Returns true if block is empty, i.e.
 
void setValid(bool valid)
Mark block as valid or invalid.
 
int height() const
Returns the height (number of rows) of the raster block.
 
char * bits(int row, int column)
Returns a pointer to block data.
 
bool setIsNoDataExcept(QRect exceptRect)
Set the whole block to no data except specified rectangle.
 
const char * constBits(qgssize index) const
Returns a const pointer to block data.
 
void applyNoDataValues(const QgsRasterRangeList &rangeList)
 
void setNoDataValue(double noDataValue)
Sets cell value that will be considered as "no data".
 
int width() const
Returns the width (number of columns) of the raster block.
 
void applyScaleOffset(double scale, double offset)
Apply band scale and offset to raster block values.
 
static QRect subRect(const QgsRectangle &extent, int width, int height, const QgsRectangle &subExtent)
For extent and width, height find rectangle covered by subextent.
 
void setError(const QgsError &error)
Sets the last error.
 
bool setIsNoData(int row, int column)
Set no data on pixel.
 
Handles elevation related properties for a raster data provider.
 
Implementation of data provider temporal properties for QgsRasterDataProviders.
 
Base class for raster data providers.
 
double mMaxOversampling
Maximum boundary for oversampling (to avoid too much data traffic). Default: 2.0.
 
virtual bool write(const void *data, int band, int width, int height, int xOffset, int yOffset)
Writes into the provider datasource.
 
QList< bool > mUseSrcNoDataValue
Use source nodata value.
 
TransformType
Types of transformation in transformCoordinates() function.
 
bool writeFileBasedAttributeTable(int bandNumber, const QString &path, QString *errorMessage=nullptr) const
Writes the filesystem-based attribute table for the specified bandNumber to path, optionally reportin...
 
static Qgis::RasterInterfaceCapability identifyFormatToCapability(Qgis::RasterIdentifyFormat format)
Converts a raster identify format to a capability.
 
virtual bool sourceHasNoDataValue(int bandNo) const
Returns true if source band has no data value.
 
static QString encodeVirtualRasterProviderUri(const VirtualRasterParameters &parts)
Encodes the URI starting from the struct .
 
virtual double bandOffset(int bandNo) const
Read band offset for raster value.
 
virtual QString lastErrorFormat()
Returns the format of the error text for the last error in this provider.
 
bool mProviderResamplingEnabled
Whether provider resampling is enabled.
 
virtual bool writeNativeAttributeTable(QString *errorMessage=nullptr)
Writes the native attribute table, optionally reporting any error in errorMessage,...
 
virtual bool useSourceNoDataValue(int bandNo) const
Returns the source nodata value usage.
 
bool readFileBasedAttributeTable(int bandNumber, const QString &path, QString *errorMessage=nullptr)
Loads the filesystem-based attribute table for the specified bandNumber from path,...
 
static QgsRasterDataProvider::VirtualRasterParameters decodeVirtualRasterProviderUri(const QString &uri, bool *ok=nullptr)
Decodes the URI returning a struct with all the parameters for QgsVirtualRasterProvider class.
 
virtual void setUseSourceNoDataValue(int bandNo, bool use)
Sets the source nodata value usage.
 
QgsRasterAttributeTable * attributeTable(int bandNumber) const
Returns the (possibly NULL) attribute table for the specified bandNumber.
 
void setAttributeTable(int bandNumber, QgsRasterAttributeTable *attributeTable)
Set the attribute table to attributeTable for the specified bandNumber, if the attributeTable is NULL...
 
virtual double sourceNoDataValue(int bandNo) const
Value representing no data value.
 
void readXml(const QDomElement &filterElem) override
Sets base class members from xml. Usually called from create() methods of subclasses.
 
QList< QgsRasterRangeList > mUserNoDataValue
List of lists of user defined additional no data values for each band, indexed from 0.
 
virtual bool isEditable() const
Checks whether the provider is in editing mode, i.e.
 
QString colorName(Qgis::RasterColorInterpretation colorInterpretation) const
Returns a string color name representation of a color interpretation.
 
virtual bool readNativeAttributeTable(QString *errorMessage=nullptr)
Reads the native attribute table, optionally reporting any error in errorMessage, returns true on suc...
 
void copyBaseSettings(const QgsRasterDataProvider &other)
Copy member variables from other raster data provider. Useful for implementation of clone() method in...
 
bool userNoDataValuesContains(int bandNo, double value) const
Returns true if user no data contains value.
 
bool writeBlock(QgsRasterBlock *block, int band, int xOffset=0, int yOffset=0)
Writes pixel data from a raster block into the provider data source.
 
virtual bool enableProviderResampling(bool enable)
Enable or disable provider-level resampling.
 
QgsRectangle extent() const override=0
Returns the extent of the layer.
 
virtual bool ignoreExtents() const
Returns true if the extents reported by the data provider are not reliable and it's possible that the...
 
virtual bool setMaxOversampling(double factor)
Sets maximum oversampling factor for zoomed-out operations.
 
Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
 
ResamplingMethod mZoomedOutResamplingMethod
Resampling method for zoomed out pixel extraction.
 
QgsRasterDataProviderElevationProperties * elevationProperties() override
Returns the provider's elevation properties.
 
bool hasPyramids()
Returns true if raster has at least one existing pyramid.
 
virtual QgsRasterIdentifyResult identify(const QgsPointXY &point, Qgis::RasterIdentifyFormat format, const QgsRectangle &boundingBox=QgsRectangle(), int width=0, int height=0, int dpi=96)
Identify raster value(s) found on the point position.
 
virtual double bandScale(int bandNo) const
Read band scale for raster value.
 
int dpi() const
Returns the dpi of the output device.
 
virtual Qgis::RasterColorInterpretation colorInterpretation(int bandNo) const
Returns data type for the band specified by number.
 
virtual double sample(const QgsPointXY &point, int band, bool *ok=nullptr, const QgsRectangle &boundingBox=QgsRectangle(), int width=0, int height=0, int dpi=96)
Samples a raster value from the specified band found at the point position.
 
QgsRasterBlock * block(int bandNo, const QgsRectangle &boundingBox, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size.
 
QList< double > mSrcNoDataValue
Source no data value is available and is set to be used or internal no data is available.
 
virtual bool readBlock(int bandNo, int xBlock, int yBlock, void *data)
Reads a block of raster data into data.
 
ResamplingMethod mZoomedInResamplingMethod
Resampling method for zoomed in pixel extraction.
 
virtual Qgis::RasterProviderCapabilities providerCapabilities() const
Returns flags containing the supported capabilities of the data provider.
 
QList< bool > mSrcHasNoDataValue
Source no data value exists.
 
void removeAttributeTable(int bandNumber)
Remove the attribute table for the specified bandNumber.
 
static QgsRasterDataProvider * create(const QString &providerKey, const QString &uri, const QString &format, int nBands, Qgis::DataType type, int width, int height, double *geoTransform, const QgsCoordinateReferenceSystem &crs, const QStringList &createOptions=QStringList())
Creates a new dataset with mDataSourceURI.
 
virtual QgsRasterRangeList userNoDataValues(int bandNo) const
Returns a list of user no data value ranges.
 
virtual bool setZoomedInResamplingMethod(ResamplingMethod method)
Set resampling method to apply for zoomed-in operations.
 
static QList< QPair< QString, QString > > pyramidResamplingMethods(const QString &providerKey)
Returns a list of pyramid resampling method name and label pairs for given provider.
 
void writeXml(QDomDocument &doc, QDomElement &parentElem) const override
Write base class members to xml.
 
virtual QList< double > nativeResolutions() const
Returns a list of native resolutions if available, i.e.
 
virtual QgsPoint transformCoordinates(const QgsPoint &point, TransformType type)
Transforms coordinates between source image coordinate space [0..width]x[0..height] and layer coordin...
 
static QString identifyFormatName(Qgis::RasterIdentifyFormat format)
Converts a raster identify format to a string name.
 
QgsRasterDataProviderTemporalCapabilities * temporalCapabilities() override
Returns the provider's temporal capabilities.
 
QString colorInterpretationName(int bandNo) const override
Returns the name of the color interpretation for the specified bandNumber.
 
ResamplingMethod
Resampling method for provider-level resampling.
 
@ Lanczos
Lanczos windowed sinc interpolation (6x6 kernel)
 
@ Nearest
Nearest-neighbour resampling.
 
@ Mode
Mode (selects the value which appears most often of all the sampled points)
 
@ Bilinear
Bilinear (2x2 kernel) resampling.
 
@ Average
Average resampling.
 
@ CubicSpline
Cubic B-Spline Approximation (4x4 kernel)
 
@ Cubic
Cubic Convolution Approximation (4x4 kernel) resampling.
 
virtual QString bandDescription(int bandNumber)
Returns the description for band bandNumber, or an empty string if the band is not valid or has not d...
 
static Qgis::RasterIdentifyFormat identifyFormatFromName(const QString &formatName)
Converts a string formatName to a raster identify format.
 
static QString identifyFormatLabel(Qgis::RasterIdentifyFormat format)
Converts a raster identify format to a translated string label.
 
virtual void setUserNoDataValue(int bandNo, const QgsRasterRangeList &noData)
 
virtual bool setZoomedOutResamplingMethod(ResamplingMethod method)
Set resampling method to apply for zoomed-out operations.
 
virtual QList< QgsRasterPyramid > buildPyramidList(const QList< int > &overviewList=QList< int >())
Returns the raster layers pyramid list.
 
The QgsRasterHistogram is a container for histogram of a single raster band.
 
Raster identify results container.
 
Base class for processing filters like renderers, reprojector, resampler etc.
 
virtual Qgis::RasterInterfaceCapabilities capabilities() const
Returns the capabilities supported by the interface.
 
QList< QgsRasterBandStats > mStatistics
List of cached statistics, all bands mixed.
 
virtual int xSize() const
Gets raster size.
 
virtual int bandCount() const =0
Gets number of bands.
 
int dataTypeSize(int bandNo) const
Returns the size (in bytes) for the data type for the specified band.
 
virtual int ySize() const
 
QList< QgsRasterHistogram > mHistograms
List of cached histograms, all bands mixed.
 
virtual QgsRasterHistogram histogram(int bandNo, int binCount=0, double minimum=std::numeric_limits< double >::quiet_NaN(), double maximum=std::numeric_limits< double >::quiet_NaN(), const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, bool includeOutOfRange=false, QgsRasterBlockFeedback *feedback=nullptr)
Returns a band histogram.
 
This struct is used to store pyramid info for the raster layer.
 
bool contains(double value) const
Returns true if this range contains the specified value.
 
A rectangle specified with double values.
 
QString toString(int precision=16) const
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
 
double xMinimum() const
Returns the x minimum value (left side of rectangle).
 
void setYMinimum(double y)
Set the minimum y value.
 
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
 
void setXMinimum(double x)
Set the minimum x value.
 
double width() const
Returns the width of the rectangle.
 
double xMaximum() const
Returns the x maximum value (right side of rectangle).
 
bool isNull() const
Test if the rectangle is null (holding no spatial information).
 
double yMaximum() const
Returns the y maximum value (top side of rectangle).
 
void setYMaximum(double y)
Set the maximum y value.
 
void setXMaximum(double x)
Set the maximum x value.
 
bool isEmpty() const
Returns true if the rectangle has no area.
 
double height() const
Returns the height of the rectangle.
 
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
 
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...
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
 
#define QgsDebugMsgLevel(str, level)
 
#define QgsDebugError(str)
 
QList< QgsRasterRange > QgsRasterRangeList
 
#define QGIS_PROTECT_QOBJECT_THREAD_ACCESS
 
const QgsCoordinateReferenceSystem & crs
 
Setting options for creating vector data providers.
 
Struct that stores the information about the parameters that should be given to the QgsVirtualRasterP...
 
QList< QgsRasterDataProvider::VirtualRasterInputLayers > rInputLayers
 
QgsCoordinateReferenceSystem crs