QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
Classes | Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsRasterDataProvider Class Referenceabstract

Base class for raster data providers. More...

#include <qgsrasterdataprovider.h>

Inheritance diagram for QgsRasterDataProvider:
Inheritance graph
[legend]

Classes

struct  VirtualRasterInputLayers
 Struct that stores information of the raster used in QgsVirtualRasterProvider for the calculations, this struct is stored in the DecodedUriParameters. More...
 
struct  VirtualRasterParameters
 Struct that stores the information about the parameters that should be given to the QgsVirtualRasterProvider through the QgsRasterDataProvider::DecodedUriParameters. More...
 

Public Types

enum  ProviderCapability {
  NoProviderCapabilities = 0 , ReadLayerMetadata = 1 << 1 , WriteLayerMetadata = 1 << 2 , ProviderHintBenefitsFromResampling = 1 << 3 ,
  ProviderHintCanPerformProviderResampling = 1 << 4 , ReloadData = 1 << 5 , DpiDependentData = 1 << 6 , NativeRasterAttributeTable = 1 << 7
}
 Enumeration with capabilities that raster providers might implement. More...
 
enum class  ResamplingMethod {
  Nearest , Bilinear , Cubic , CubicSpline ,
  Lanczos , Average , Mode , Gauss
}
 Resampling method for provider-level resampling. More...
 
enum  TransformType { TransformImageToLayer , TransformLayerToImage }
 Types of transformation in transformCoordinates() function. More...
 
- Public Types inherited from QgsDataProvider
enum  DataCapability {
  NoDataCapabilities = 0 , File = 1 , Dir = 1 << 1 , Database = 1 << 2 ,
  Net = 1 << 3
}
 Used in browser model to understand which items for which providers should be populated. More...
 
enum  ProviderProperty { EvaluateDefaultValues , CustomData = 3000 }
 Properties are used to pass custom configuration options into data providers. More...
 
enum  ReadFlag {
  FlagTrustDataSource = 1 << 0 , SkipFeatureCount = 1 << 1 , FlagLoadDefaultStyle = 1 << 2 , SkipGetExtent = 1 << 3 ,
  SkipFullScan = 1 << 4 , ForceReadOnly = 1 << 5
}
 Flags which control dataprovider construction. More...
 
- Public Types inherited from QgsRasterInterface
enum  Capability {
  NoCapabilities = 0 , Size = 1 << 1 , Create = 1 << 2 , Remove = 1 << 3 ,
  BuildPyramids = 1 << 4 , Identify = 1 << 5 , IdentifyValue = 1 << 6 , IdentifyText = 1 << 7 ,
  IdentifyHtml = 1 << 8 , IdentifyFeature = 1 << 9 , Prefetch = 1 << 10
}
 If you add to this, please also add to capabilitiesString() More...
 

Signals

void statusChanged (const QString &) const
 Emit a message to be displayed on status bar, usually used by network providers (WMS,WCS) More...
 
- Signals inherited from QgsDataProvider
void dataChanged ()
 Emitted whenever a change is made to the data provider which may have caused changes in the provider's data OUTSIDE of QGIS. More...
 
void fullExtentCalculated ()
 Emitted whenever a deferred extent calculation is completed by the provider. More...
 
void notify (const QString &msg)
 Emitted when the datasource issues a notification. More...
 

Public Member Functions

 QgsRasterDataProvider ()
 Provider capabilities. More...
 
 QgsRasterDataProvider (const QString &uri, const QgsDataProvider::ProviderOptions &providerOptions=QgsDataProvider::ProviderOptions(), QgsDataProvider::ReadFlags flags=QgsDataProvider::ReadFlags())
 Constructor for QgsRasterDataProvider. More...
 
QgsRasterAttributeTableattributeTable (int bandNumber) const
 Returns the (possibly NULL) attribute table for the specified bandNumber. More...
 
virtual double bandOffset (int bandNo) const
 Read band offset for raster value. More...
 
virtual double bandScale (int bandNo) const
 Read band scale for raster value. More...
 
QgsRasterBlockblock (int bandNo, const QgsRectangle &boundingBox, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
 Read block of data using given extent and size. More...
 
virtual QList< QgsRasterPyramidbuildPyramidList (const QList< int > &overviewList=QList< int >())
 Returns the raster layers pyramid list. More...
 
virtual QString buildPyramids (const QList< QgsRasterPyramid > &pyramidList, const QString &resamplingMethod="NEAREST", Qgis::RasterPyramidFormat format=Qgis::RasterPyramidFormat::GeoTiff, const QStringList &configOptions=QStringList(), QgsRasterBlockFeedback *feedback=nullptr)
 Creates pyramid overviews. More...
 
QgsRasterDataProviderclone () const override=0
 Clone itself, create deep copy. More...
 
virtual Qgis::RasterColorInterpretation colorInterpretation (int bandNo) const
 Returns data type for the band specified by number. More...
 
QString colorInterpretationName (int bandNo) const override
 Returns the name of the color interpretation for the specified bandNumber. More...
 
QString colorName (Qgis::RasterColorInterpretation colorInterpretation) const
 Returns a string color name representation of a color interpretation. More...
 
virtual QList< QgsColorRampShader::ColorRampItemcolorTable (int bandNo) const
 
QDateTime dataTimestamp () const override
 Current time stamp of data source. More...
 
Qgis::DataType dataType (int bandNo) const override=0
 Returns data type for the band specified by number. More...
 
int dpi () const
 Returns the dpi of the output device. More...
 
virtual bool enableProviderResampling (bool enable)
 Enable or disable provider-level resampling. More...
 
QgsRectangle extent () const override=0
 Returns the extent of the layer. More...
 
virtual QgsFields fields () const
 Returns the fields of the raster layer for data providers that expose them, the default implementation returns an empty list. More...
 
virtual QImage getLegendGraphic (double scale=0, bool forceRefresh=false, const QgsRectangle *visibleExtent=nullptr)
 Returns the legend rendered as pixmap. More...
 
virtual QgsImageFetchergetLegendGraphicFetcher (const QgsMapSettings *mapSettings)
 Returns a new image downloader for the raster legend. More...
 
bool hasPyramids ()
 Returns true if raster has at least one existing pyramid. More...
 
virtual QString htmlMetadata ()=0
 Returns metadata in a format suitable for feeding directly into a subset of the GUI raster properties "Metadata" tab. More...
 
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. More...
 
virtual bool ignoreExtents () const
 Returns true if the extents reported by the data provider are not reliable and it's possible that there is renderable content outside of these extents. More...
 
virtual bool isEditable () const
 Checks whether the provider is in editing mode, i.e. More...
 
bool isProviderResamplingEnabled () const
 Returns whether provider-level resampling is enabled. More...
 
virtual QString lastError ()=0
 Returns the verbose error text for the last error in this provider. More...
 
virtual QString lastErrorFormat ()
 Returns the format of the error text for the last error in this provider. More...
 
virtual QString lastErrorTitle ()=0
 Returns the caption error text for the last error in this provider. More...
 
double maxOversampling () const
 Returns maximum oversampling factor for zoomed-out operations. More...
 
virtual QList< double > nativeResolutions () const
 Returns a list of native resolutions if available, i.e. More...
 
virtual QgsRasterDataProvider::ProviderCapabilities providerCapabilities () const
 Returns flags containing the supported capabilities of the data provider. More...
 
bool readFileBasedAttributeTable (int bandNumber, const QString &path, QString *errorMessage=nullptr)
 Loads the filesystem-based attribute table for the specified bandNumber from path, optionally reporting any error in errorMessage, returns true on success. More...
 
virtual bool readNativeAttributeTable (QString *errorMessage=nullptr)
 Reads the native attribute table, optionally reporting any error in errorMessage, returns true on success. More...
 
void readXml (const QDomElement &filterElem) override
 Sets base class members from xml. Usually called from create() methods of subclasses. More...
 
virtual bool reload ()
 Reload data (data could change) More...
 
virtual bool remove ()
 Remove dataset. More...
 
void removeAttributeTable (int bandNumber)
 Remove the attribute table for the specified bandNumber. More...
 
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. More...
 
void setAttributeTable (int bandNumber, QgsRasterAttributeTable *attributeTable)
 Set the attribute table to attributeTable for the specified bandNumber, if the attributeTable is NULL any existing attribute table for the specified band will be removed. More...
 
void setDpi (int dpi)
 Sets the output device resolution. More...
 
virtual bool setEditable (bool enabled)
 Turns on/off editing mode of the provider. More...
 
bool setInput (QgsRasterInterface *input) override
 Set input. More...
 
virtual bool setMaxOversampling (double factor)
 Sets maximum oversampling factor for zoomed-out operations. More...
 
virtual bool setNoDataValue (int bandNo, double noDataValue)
 Set no data value on created dataset. More...
 
virtual void setUserNoDataValue (int bandNo, const QgsRasterRangeList &noData)
 
virtual void setUseSourceNoDataValue (int bandNo, bool use)
 Sets the source nodata value usage. More...
 
virtual bool setZoomedInResamplingMethod (ResamplingMethod method)
 Set resampling method to apply for zoomed-in operations. More...
 
virtual bool setZoomedOutResamplingMethod (ResamplingMethod method)
 Set resampling method to apply for zoomed-out operations. More...
 
Qgis::DataType sourceDataType (int bandNo) const override=0
 Returns source data type for the band specified by number, source data type may be shorter than dataType. More...
 
virtual bool sourceHasNoDataValue (int bandNo) const
 Returns true if source band has no data value. More...
 
virtual double sourceNoDataValue (int bandNo) const
 Value representing no data value. More...
 
virtual int stepHeight () const
 Step height for raster iterations. More...
 
virtual int stepWidth () const
 Step width for raster iterations. More...
 
QStringList subLayers () const override
 Returns the sublayers of this layer - useful for providers that manage their own layers, such as WMS. More...
 
virtual bool supportsLegendGraphic () const
 Returns whether the provider supplies a legend graphic. More...
 
const QgsRasterDataProviderTemporalCapabilitiestemporalCapabilities () const override
 Returns the provider's temporal capabilities. More...
 
QgsRasterDataProviderTemporalCapabilitiestemporalCapabilities () override
 Returns the provider's temporal capabilities. More...
 
QDateTime timestamp () const override
 Time stamp of data source in the moment when data/metadata were loaded by provider. More...
 
virtual QgsPoint transformCoordinates (const QgsPoint &point, TransformType type)
 Transforms coordinates between source image coordinate space [0..width]x[0..height] and layer coordinate space (georeferenced coordinates). More...
 
virtual QgsRasterRangeList userNoDataValues (int bandNo) const
 Returns a list of user no data value ranges. More...
 
virtual bool useSourceNoDataValue (int bandNo) const
 Returns the source nodata value usage. More...
 
virtual QString validateCreationOptions (const QStringList &createOptions, const QString &format)
 Validates creation options for a specific dataset and destination format. More...
 
virtual QString validatePyramidsConfigOptions (Qgis::RasterPyramidFormat pyramidsFormat, const QStringList &configOptions, const QString &fileFormat)
 Validates pyramid creation options for a specific dataset and destination format. More...
 
virtual bool write (void *data, int band, int width, int height, int xOffset, int yOffset)
 Writes into the provider datasource. More...
 
bool writeBlock (QgsRasterBlock *block, int band, int xOffset=0, int yOffset=0)
 Writes pixel data from a raster block into the provider data source. More...
 
bool writeFileBasedAttributeTable (int bandNumber, const QString &path, QString *errorMessage=nullptr) const
 Writes the filesystem-based attribute table for the specified bandNumber to path, optionally reporting any error in errorMessage, returns true on success. More...
 
virtual bool writeNativeAttributeTable (QString *errorMessage=nullptr)
 Writes the native attribute table, optionally reporting any error in errorMessage, returns true on success. More...
 
void writeXml (QDomDocument &doc, QDomElement &parentElem) const override
 Write base class members to xml. More...
 
ResamplingMethod zoomedInResamplingMethod () const
 Returns resampling method for zoomed-in operations. More...
 
ResamplingMethod zoomedOutResamplingMethod () const
 Returns resampling method for zoomed-out operations. More...
 
- Public Member Functions inherited from QgsDataProvider
 QgsDataProvider (const QString &uri=QString(), const QgsDataProvider::ProviderOptions &providerOptions=QgsDataProvider::ProviderOptions(), QgsDataProvider::ReadFlags flags=QgsDataProvider::ReadFlags())
 Create a new dataprovider with the specified in the uri. More...
 
virtual QgsCoordinateReferenceSystem crs () const =0
 Returns the coordinate system for the data source. More...
 
virtual QString dataComment () const
 Returns a short comment for the data that this provider is providing access to (e.g. More...
 
virtual QString dataSourceUri (bool expandAuthConfig=false) const
 Gets the data source specification. More...
 
virtual QDateTime dataTimestamp () const
 Current time stamp of data source. More...
 
virtual QString description () const =0
 Returns description. More...
 
virtual bool enterUpdateMode ()
 Enter update mode. More...
 
virtual QgsError error () const
 Gets current status error. More...
 
virtual QgsRectangle extent () const =0
 Returns the extent of the layer. More...
 
virtual QString fileRasterFilters () const
 Returns raster file filter string. More...
 
virtual QString fileVectorFilters () const
 Returns vector file filter string. More...
 
virtual Qgis::DataProviderFlags flags () const
 Returns the generic data provider flags. More...
 
virtual void invalidateConnections (const QString &connection)
 Invalidate connections corresponding to specified name. More...
 
virtual bool isValid () const =0
 Returns true if this is a valid layer. More...
 
virtual QgsLayerMetadata layerMetadata () const
 Returns layer metadata collected from the provider's source. More...
 
virtual bool leaveUpdateMode ()
 Leave update mode. More...
 
virtual QString name () const =0
 Returns a provider name. More...
 
QVariant providerProperty (int property, const QVariant &defaultValue) const
 Gets the current value of a certain provider property. More...
 
QVariant providerProperty (ProviderProperty property, const QVariant &defaultValue=QVariant()) const
 Gets the current value of a certain provider property. More...
 
virtual void reloadData ()
 Reloads the data from the source for providers with data caches to synchronize, changes in the data source, feature counts and other specific actions. More...
 
virtual bool renderInPreview (const QgsDataProvider::PreviewContext &context)
 Returns whether the layer must be rendered in preview jobs. More...
 
virtual void setDataSourceUri (const QString &uri)
 Set the data source specification. More...
 
virtual void setLayerOrder (const QStringList &layers)
 Reorder the list of layer names to be rendered by this provider (in order from bottom to top) More...
 
virtual void setListening (bool isListening)
 Set whether the provider will listen to datasource notifications If set, the provider will issue notify signals. More...
 
void setProviderProperty (int property, const QVariant &value)
 Allows setting arbitrary properties on the provider. More...
 
void setProviderProperty (ProviderProperty property, const QVariant &value)
 Allows setting arbitrary properties on the provider. More...
 
virtual void setSubLayerVisibility (const QString &name, bool vis)
 Set the visibility of the given sublayer name. More...
 
virtual bool setSubsetString (const QString &subset, bool updateFeatureCount=true)
 Set the subset string used to create a subset of features in the layer. More...
 
virtual void setTransformContext (const QgsCoordinateTransformContext &transformContext)
 Sets data coordinate transform context to transformContext. More...
 
void setUri (const QgsDataSourceUri &uri)
 Set the data source specification. More...
 
virtual uint subLayerCount () const
 Returns the number of layers for the current data source. More...
 
virtual QStringList subLayers () const
 Sub-layers handled by this provider, in order from bottom to top. More...
 
virtual QStringList subLayerStyles () const
 Sub-layer styles for each sub-layer handled by this provider, in order from bottom to top. More...
 
virtual QString subsetString () const
 Returns the subset definition string (typically sql) currently in use by the layer and used by the provider to limit the feature set. More...
 
virtual bool supportsSubsetString () const
 Returns true if the provider supports setting of subset strings. More...
 
virtual QgsDataProviderTemporalCapabilitiestemporalCapabilities ()
 Returns the provider's temporal capabilities. More...
 
virtual const QgsDataProviderTemporalCapabilitiestemporalCapabilities () const
 Returns the provider's temporal capabilities. More...
 
virtual QDateTime timestamp () const
 Time stamp of data source in the moment when data/metadata were loaded by provider. More...
 
QgsCoordinateTransformContext transformContext () const
 Returns data provider coordinate transform context. More...
 
virtual void updateExtents ()
 Update the extents of the layer. More...
 
QgsDataSourceUri uri () const
 Gets the data source specification. More...
 
virtual bool writeLayerMetadata (const QgsLayerMetadata &metadata)
 Writes layer metadata to the underlying provider source. More...
 
- Public Member Functions inherited from QgsRasterInterface
 QgsRasterInterface (QgsRasterInterface *input=nullptr)
 
virtual ~QgsRasterInterface ()=default
 
virtual int bandCount () const =0
 Gets number of bands. More...
 
virtual QgsRasterBandStats bandStatistics (int bandNo, int stats=QgsRasterBandStats::All, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, QgsRasterBlockFeedback *feedback=nullptr)
 Returns the band statistics. More...
 
virtual QgsRasterBlockblock (int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)=0
 Read block of data using given extent and size. More...
 
virtual int capabilities () const
 Returns a bitmask containing the supported capabilities. More...
 
QString capabilitiesString () const
 Returns the raster interface capabilities in friendly format. More...
 
virtual QgsRasterInterfaceclone () const =0
 Clone itself, create deep copy. More...
 
virtual QString colorInterpretationName (int bandNumber) const
 Returns the name of the color interpretation for the specified bandNumber. More...
 
virtual void cumulativeCut (int bandNo, double lowerCount, double upperCount, double &lowerValue, double &upperValue, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0)
 Find values for cumulative pixel count cut. More...
 
virtual Qgis::DataType dataType (int bandNo) const =0
 Returns data type for the band specified by number. More...
 
int dataTypeSize (int bandNo) const
 Returns the size (in bytes) for the data type for the specified band. More...
 
QString displayBandName (int bandNumber) const
 Generates a friendly, descriptive name for the specified bandNumber. More...
 
virtual QgsRectangle extent () const
 Gets the extent of the interface. More...
 
virtual QString generateBandName (int bandNumber) const
 helper function to create zero padded band names More...
 
virtual bool hasHistogram (int bandNo, int binCount, 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)
 Returns true if histogram is available (cached, already calculated) More...
 
virtual bool hasStatistics (int bandNo, int stats=QgsRasterBandStats::All, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0)
 Returns true if histogram is available (cached, already calculated). More...
 
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. More...
 
virtual QgsRasterInterfaceinput () const
 Current input. More...
 
virtual bool on () const
 Returns whether the interface is on or off. More...
 
virtual void readXml (const QDomElement &filterElem)
 Sets base class members from xml. Usually called from create() methods of subclasses. More...
 
virtual bool setInput (QgsRasterInterface *input)
 Set input. More...
 
virtual void setOn (bool on)
 Sets whether the interface is on or off. More...
 
virtual Qgis::DataType sourceDataType (int bandNo) const
 Returns source data type for the band specified by number, source data type may be shorter than dataType. More...
 
virtual QgsRasterInterfacesourceInput ()
 Gets source / raw input, the first in pipe, usually provider. More...
 
virtual const QgsRasterInterfacesourceInput () const
 Gets source / raw input, the first in pipe, usually provider. More...
 
virtual void writeXml (QDomDocument &doc, QDomElement &parentElem) const
 Write base class members to xml. More...
 
virtual int xBlockSize () const
 Gets block size. More...
 
virtual int xSize () const
 Gets raster size. More...
 
virtual int yBlockSize () const
 
virtual int ySize () const
 

Static Public Member Functions

static QgsRasterDataProvidercreate (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. More...
 
static QgsRasterDataProvider::VirtualRasterParameters decodeVirtualRasterProviderUri (const QString &uri, bool *ok=nullptr)
 Decodes the URI returning a struct with all the parameters for QgsVirtualRasterProvider class. More...
 
static QString encodeVirtualRasterProviderUri (const VirtualRasterParameters &parts)
 Encodes the URI starting from the struct . More...
 
static Qgis::RasterIdentifyFormat identifyFormatFromName (const QString &formatName)
 Converts a string formatName to a raster identify format. More...
 
static QString identifyFormatLabel (Qgis::RasterIdentifyFormat format)
 Converts a raster identify format to a translated string label. More...
 
static QString identifyFormatName (Qgis::RasterIdentifyFormat format)
 Converts a raster identify format to a string name. More...
 
static Capability identifyFormatToCapability (Qgis::RasterIdentifyFormat format)
 Converts a raster identify format to a capability. More...
 
static QList< QPair< QString, QString > > pyramidResamplingMethods (const QString &providerKey)
 Returns a list of pyramid resampling method name and label pairs for given provider. More...
 
- Static Public Member Functions inherited from QgsDataProvider
static QString sublayerSeparator ()
 String sequence used for separating components of sublayers strings. More...
 

Protected Member Functions

void copyBaseSettings (const QgsRasterDataProvider &other)
 Copy member variables from other raster data provider. Useful for implementation of clone() method in subclasses. More...
 
virtual bool readBlock (int bandNo, int xBlock, int yBlock, void *data)
 Reads a block of raster data into data. More...
 
virtual bool readBlock (int bandNo, QgsRectangle const &viewExtent, int width, int height, void *data, QgsRasterBlockFeedback *feedback=nullptr)
 Reads a block of raster data into data, using the given extent and size. More...
 
bool userNoDataValuesContains (int bandNo, double value) const
 Returns true if user no data contains value. More...
 
- Protected Member Functions inherited from QgsDataProvider
void appendError (const QgsErrorMessage &message)
 Add error message. More...
 
void setError (const QgsError &error)
 Sets error message. More...
 
- Protected Member Functions inherited from QgsRasterInterface
void initHistogram (QgsRasterHistogram &histogram, int bandNo, int binCount, double minimum=std::numeric_limits< double >::quiet_NaN(), double maximum=std::numeric_limits< double >::quiet_NaN(), const QgsRectangle &boundingBox=QgsRectangle(), int sampleSize=0, bool includeOutOfRange=false)
 Fill in histogram defaults if not specified. More...
 
void initStatistics (QgsRasterBandStats &statistics, int bandNo, int stats=QgsRasterBandStats::All, const QgsRectangle &boundingBox=QgsRectangle(), int binCount=0) const
 Fill in statistics defaults if not specified. More...
 

Protected Attributes

int mDpi = -1
 Dots per inch. More...
 
QgsRectangle mExtent
 
double mMaxOversampling = 2.0
 Maximum boundary for oversampling (to avoid too much data traffic). Default: 2.0. More...
 
bool mProviderResamplingEnabled = false
 Whether provider resampling is enabled. More...
 
QList< bool > mSrcHasNoDataValue
 Source no data value exists. More...
 
QList< double > mSrcNoDataValue
 Source no data value is available and is set to be used or internal no data is available. More...
 
QList< QgsRasterRangeListmUserNoDataValue
 List of lists of user defined additional no data values for each band, indexed from 0. More...
 
QList< bool > mUseSrcNoDataValue
 Use source nodata value. More...
 
ResamplingMethod mZoomedInResamplingMethod = ResamplingMethod::Nearest
 Resampling method for zoomed in pixel extraction. More...
 
ResamplingMethod mZoomedOutResamplingMethod = ResamplingMethod::Nearest
 Resampling method for zoomed out pixel extraction. More...
 
- Protected Attributes inherited from QgsDataProvider
QgsError mError
 Error. More...
 
QgsDataProvider::ReadFlags mReadFlags = QgsDataProvider::ReadFlags()
 Read flags. It's up to the subclass to respect these when needed. More...
 
QDateTime mTimestamp
 Timestamp of data in the moment when the data were loaded by provider. More...
 
- Protected Attributes inherited from QgsRasterInterface
QList< QgsRasterHistogrammHistograms
 List of cached histograms, all bands mixed. More...
 
QgsRasterInterfacemInput = nullptr
 
bool mOn = true
 
QList< QgsRasterBandStatsmStatistics
 List of cached statistics, all bands mixed. More...
 

Detailed Description

Base class for raster data providers.

Definition at line 88 of file qgsrasterdataprovider.h.

Member Enumeration Documentation

◆ ProviderCapability

Enumeration with capabilities that raster providers might implement.

Since
QGIS 3.0
Enumerator
NoProviderCapabilities 

Provider has no capabilities.

ReadLayerMetadata 

Provider can read layer metadata from data store. Since QGIS 3.0. See QgsDataProvider::layerMetadata()

WriteLayerMetadata 

Provider can write layer metadata to the data store. Since QGIS 3.0. See QgsDataProvider::writeLayerMetadata()

ProviderHintBenefitsFromResampling 

Provider benefits from resampling and should apply user default resampling settings (since QGIS 3.10)

ProviderHintCanPerformProviderResampling 

Provider can perform resampling (to be opposed to post rendering resampling) (since QGIS 3.16)

ReloadData 

Is able to force reload data / clear local caches. Since QGIS 3.18, see QgsDataProvider::reloadProviderData()

DpiDependentData 
NativeRasterAttributeTable 

Provider's rendering is dependent on requested pixel size of the viewport (since QGIS 3.20)

Indicates that the provider supports native raster attribute table (since QGIS 3.30)

Definition at line 98 of file qgsrasterdataprovider.h.

◆ ResamplingMethod

Resampling method for provider-level resampling.

Since
QGIS 3.16
Enumerator
Nearest 

Nearest-neighbour resampling.

Bilinear 

Bilinear (2x2 kernel) resampling.

Cubic 

Cubic Convolution Approximation (4x4 kernel) resampling.

CubicSpline 

Cubic B-Spline Approximation (4x4 kernel)

Lanczos 

Lanczos windowed sinc interpolation (6x6 kernel)

Average 

Average resampling.

Mode 

Mode (selects the value which appears most often of all the sampled points)

Gauss 

Gauss blurring.

Definition at line 709 of file qgsrasterdataprovider.h.

◆ TransformType

Types of transformation in transformCoordinates() function.

Since
QGIS 3.14
Enumerator
TransformImageToLayer 

Transforms image coordinates to layer (georeferenced) coordinates.

TransformLayerToImage 

Transforms layer (georeferenced) coordinates to image coordinates.

Definition at line 662 of file qgsrasterdataprovider.h.

Constructor & Destructor Documentation

◆ QgsRasterDataProvider() [1/2]

QgsRasterDataProvider::QgsRasterDataProvider ( )

Provider capabilities.

Definition at line 235 of file qgsrasterdataprovider.cpp.

◆ QgsRasterDataProvider() [2/2]

QgsRasterDataProvider::QgsRasterDataProvider ( const QString &  uri,
const QgsDataProvider::ProviderOptions providerOptions = QgsDataProvider::ProviderOptions(),
QgsDataProvider::ReadFlags  flags = QgsDataProvider::ReadFlags() 
)

Constructor for QgsRasterDataProvider.

The uri argument gives a provider-specific uri indicating the underlying data source and it's parameters.

The options argument specifies generic provider options and since QGIS 3.16 creation flags are specified within the flags value.

Definition at line 243 of file qgsrasterdataprovider.cpp.

Member Function Documentation

◆ attributeTable()

QgsRasterAttributeTable * QgsRasterDataProvider::attributeTable ( int  bandNumber) const

Returns the (possibly NULL) attribute table for the specified bandNumber.

Since
QGIS 3.30

Definition at line 681 of file qgsrasterdataprovider.cpp.

◆ bandOffset()

virtual double QgsRasterDataProvider::bandOffset ( int  bandNo) const
inlinevirtual

Read band offset for raster value.

Since
QGIS 2.3

Definition at line 239 of file qgsrasterdataprovider.h.

◆ bandScale()

virtual double QgsRasterDataProvider::bandScale ( int  bandNo) const
inlinevirtual

Read band scale for raster value.

Since
QGIS 2.3

Definition at line 233 of file qgsrasterdataprovider.h.

◆ block()

QgsRasterBlock * QgsRasterDataProvider::block ( int  bandNo,
const QgsRectangle boundingBox,
int  width,
int  height,
QgsRasterBlockFeedback feedback = nullptr 
)
overridevirtual

Read block of data using given extent and size.

Implements QgsRasterInterface.

Definition at line 50 of file qgsrasterdataprovider.cpp.

◆ buildPyramidList()

virtual QList< QgsRasterPyramid > QgsRasterDataProvider::buildPyramidList ( const QList< int > &  overviewList = QList<int>())
inlinevirtual

Returns the raster layers pyramid list.

This method returns a list of pyramid layers which are valid for the data provider. The returned list is a complete list of all possible layers, and includes both pyramids layers which currently exist and layers which have not yet been constructed. To know which of the pyramid layers ACTUALLY exists you need to look at the QgsRasterPyramid::getExists() member for each value in the list.

The returned list is suitable for passing to the buildPyramids() method. First, modify the returned list by calling QgsRasterPyramid::setBuild( \c true ) for every layer you want to create pyramids for, and then pass the modified list to buildPyramids().

Parameters
overviewListused to construct the pyramid list (optional), when empty the list is defined by the provider.
See also
buildPyramids()
hasPyramids()

Definition at line 367 of file qgsrasterdataprovider.h.

◆ buildPyramids()

virtual QString QgsRasterDataProvider::buildPyramids ( const QList< QgsRasterPyramid > &  pyramidList,
const QString &  resamplingMethod = "NEAREST",
Qgis::RasterPyramidFormat  format = Qgis::RasterPyramidFormat::GeoTiff,
const QStringList &  configOptions = QStringList(),
QgsRasterBlockFeedback feedback = nullptr 
)
inlinevirtual

Creates pyramid overviews.

Parameters
pyramidLista list of QgsRasterPyramids to create overviews for. The QgsRasterPyramid::setBuild() flag should be set to true for every layer where pyramids are desired.
resamplingMethodresampling method to use when creating the pyramids. The pyramidResamplingMethods() method can be used to retrieve a list of valid resampling methods available for specific raster data providers.
formatraster pyramid format.
configOptionsoptional configuration options which are passed to the specific data provider for use during pyramid creation.
feedbackoptional feedback argument for progress reports and cancellation support.
See also
buildPyramidList()
hasPyramids()
pyramidResamplingMethods()

Definition at line 335 of file qgsrasterdataprovider.h.

◆ clone()

QgsRasterDataProvider * QgsRasterDataProvider::clone ( ) const
overridepure virtual

Clone itself, create deep copy.

Implements QgsRasterInterface.

◆ colorInterpretation()

Qgis::RasterColorInterpretation QgsRasterDataProvider::colorInterpretation ( int  bandNo) const
virtual

Returns data type for the band specified by number.

Definition at line 258 of file qgsrasterdataprovider.cpp.

◆ colorInterpretationName()

QString QgsRasterDataProvider::colorInterpretationName ( int  bandNumber) const
overridevirtual

Returns the name of the color interpretation for the specified bandNumber.

Since
QGIS 3.18

Reimplemented from QgsRasterInterface.

Definition at line 771 of file qgsrasterdataprovider.cpp.

◆ colorName()

QString QgsRasterDataProvider::colorName ( Qgis::RasterColorInterpretation  colorInterpretation) const
inline

Returns a string color name representation of a color interpretation.

Definition at line 162 of file qgsrasterdataprovider.h.

◆ colorTable()

virtual QList< QgsColorRampShader::ColorRampItem > QgsRasterDataProvider::colorTable ( int  bandNo) const
inlinevirtual

Definition at line 263 of file qgsrasterdataprovider.h.

◆ copyBaseSettings()

void QgsRasterDataProvider::copyBaseSettings ( const QgsRasterDataProvider other)
protected

Copy member variables from other raster data provider. Useful for implementation of clone() method in subclasses.

Definition at line 559 of file qgsrasterdataprovider.cpp.

◆ create()

QgsRasterDataProvider * 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() 
)
static

Creates a new dataset with mDataSourceURI.

Definition at line 437 of file qgsrasterdataprovider.cpp.

◆ dataTimestamp()

QDateTime QgsRasterDataProvider::dataTimestamp ( ) const
inlineoverridevirtual

Current time stamp of data source.

Reimplemented from QgsDataProvider.

Definition at line 465 of file qgsrasterdataprovider.h.

◆ dataType()

Qgis::DataType QgsRasterDataProvider::dataType ( int  bandNo) const
overridepure virtual

Returns data type for the band specified by number.

Implements QgsRasterInterface.

◆ decodeVirtualRasterProviderUri()

QgsRasterDataProvider::VirtualRasterParameters QgsRasterDataProvider::decodeVirtualRasterProviderUri ( const QString &  uri,
bool *  ok = nullptr 
)
static

Decodes the URI returning a struct with all the parameters for QgsVirtualRasterProvider class.

Note
used by Virtual Raster Provider only
since QGIS 3.22

Definition at line 778 of file qgsrasterdataprovider.cpp.

◆ dpi()

int QgsRasterDataProvider::dpi ( ) const
inline

Returns the dpi of the output device.

Definition at line 456 of file qgsrasterdataprovider.h.

◆ enableProviderResampling()

virtual bool QgsRasterDataProvider::enableProviderResampling ( bool  enable)
inlinevirtual

Enable or disable provider-level resampling.

Returns
true if success
Since
QGIS 3.16

Definition at line 689 of file qgsrasterdataprovider.h.

◆ encodeVirtualRasterProviderUri()

QString QgsRasterDataProvider::encodeVirtualRasterProviderUri ( const VirtualRasterParameters parts)
static

Encodes the URI starting from the struct .

Note
used by Virtual Raster Provider only
since QGIS 3.22

Definition at line 879 of file qgsrasterdataprovider.cpp.

◆ extent()

QgsRectangle QgsRasterDataProvider::extent ( ) const
overridepure virtual

Returns the extent of the layer.

Returns
QgsRectangle containing the extent of the layer

Implements QgsDataProvider.

◆ fields()

virtual QgsFields QgsRasterDataProvider::fields ( ) const
inlinevirtual

Returns the fields of the raster layer for data providers that expose them, the default implementation returns an empty list.

Since
QGIS 3.14

Definition at line 148 of file qgsrasterdataprovider.h.

◆ getLegendGraphic()

virtual QImage QgsRasterDataProvider::getLegendGraphic ( double  scale = 0,
bool  forceRefresh = false,
const QgsRectangle visibleExtent = nullptr 
)
inlinevirtual

Returns the legend rendered as pixmap.

This is useful for layers which need to get legend layers remotely as WMS.

Parameters
scaleOptional parameter that is the Scale of the layer
forceRefreshOptional bool parameter to force refresh getLegendGraphic call
visibleExtentVisible extent for providers supporting contextual legends, in layer CRS
Note
Parameter visibleExtent added in QGIS 2.8
Not available in Python bindings

Definition at line 292 of file qgsrasterdataprovider.h.

◆ getLegendGraphicFetcher()

virtual QgsImageFetcher * QgsRasterDataProvider::getLegendGraphicFetcher ( const QgsMapSettings mapSettings)
inlinevirtual

Returns a new image downloader for the raster legend.

Parameters
mapSettingsmap settings for legend providers supporting contextual legends.
Returns
a download handler or nullptr if the provider does not support legend at all. Ownership of the returned object is transferred to caller.
Since
QGIS 2.8

Definition at line 313 of file qgsrasterdataprovider.h.

◆ hasPyramids()

bool QgsRasterDataProvider::hasPyramids ( )

Returns true if raster has at least one existing pyramid.

The buildPyramidList() method can be used to retrieve additional details about potential and existing pyramid layers.

See also
buildPyramidList()
buildPyramids()

Definition at line 387 of file qgsrasterdataprovider.cpp.

◆ htmlMetadata()

virtual QString QgsRasterDataProvider::htmlMetadata ( )
pure virtual

Returns metadata in a format suitable for feeding directly into a subset of the GUI raster properties "Metadata" tab.

◆ identify()

QgsRasterIdentifyResult QgsRasterDataProvider::identify ( const QgsPointXY point,
Qgis::RasterIdentifyFormat  format,
const QgsRectangle boundingBox = QgsRectangle(),
int  width = 0,
int  height = 0,
int  dpi = 96 
)
virtual

Identify raster value(s) found on the point position.

The context parameters extent, width and height are important to identify on the same zoom level as a displayed map and to do effective caching (WCS). If context params are not specified the highest resolution is used. capabilities() may be used to test if format is supported by provider. Values are set to 'no data' or empty string if point is outside data source extent.

Parameters
pointcoordinates in data source CRS
formatresult format
boundingBoxcontext bounding box
widthcontext width
heightcontext height
dpicontext dpi
Returns
QgsRaster::IdentifyFormatValue: map of values for each band, keys are band numbers (from 1). QgsRaster::IdentifyFormatFeature: map of QgsRasterFeatureList for each sublayer QgsRaster::IdentifyFormatHtml: map of HTML strings for each sublayer (WMS). Empty if failed or there are no results.
Note
The arbitraryness of the returned document is enforced by WMS standards up to at least v1.3.0
See also
sample(), which is much more efficient for simple "value at point" queries.

Definition at line 269 of file qgsrasterdataprovider.cpp.

◆ identifyFormatFromName()

Qgis::RasterIdentifyFormat QgsRasterDataProvider::identifyFormatFromName ( const QString &  formatName)
static

Converts a string formatName to a raster identify format.

See also
identifyFormatName()

Definition at line 497 of file qgsrasterdataprovider.cpp.

◆ identifyFormatLabel()

QString QgsRasterDataProvider::identifyFormatLabel ( Qgis::RasterIdentifyFormat  format)
static

Converts a raster identify format to a translated string label.

Definition at line 479 of file qgsrasterdataprovider.cpp.

◆ identifyFormatName()

QString QgsRasterDataProvider::identifyFormatName ( Qgis::RasterIdentifyFormat  format)
static

Converts a raster identify format to a string name.

See also
identifyFormatFromName()

Definition at line 461 of file qgsrasterdataprovider.cpp.

◆ identifyFormatToCapability()

QgsRasterInterface::Capability QgsRasterDataProvider::identifyFormatToCapability ( Qgis::RasterIdentifyFormat  format)
static

Converts a raster identify format to a capability.

Definition at line 510 of file qgsrasterdataprovider.cpp.

◆ ignoreExtents()

bool QgsRasterDataProvider::ignoreExtents ( ) const
virtual

Returns true if the extents reported by the data provider are not reliable and it's possible that there is renderable content outside of these extents.

Since
QGIS 3.10.0

Definition at line 535 of file qgsrasterdataprovider.cpp.

◆ isEditable()

virtual bool QgsRasterDataProvider::isEditable ( ) const
inlinevirtual

Checks whether the provider is in editing mode, i.e.

raster write operations will be accepted. By default providers are not editable. Use setEditable() method to enable/disable editing.

See also
setEditable(), writeBlock()
Since
QGIS 3.0

Definition at line 473 of file qgsrasterdataprovider.h.

◆ isProviderResamplingEnabled()

bool QgsRasterDataProvider::isProviderResamplingEnabled ( ) const
inline

Returns whether provider-level resampling is enabled.

Note
Resampling is effective only if zoomedInResamplingMethod() and/or zoomedOutResamplingMethod() return non-nearest resampling.
See also
zoomedInResamplingMethod()
zoomedOutResamplingMethod()
maxOversampling()
Since
QGIS 3.16

Definition at line 703 of file qgsrasterdataprovider.h.

◆ lastError()

virtual QString QgsRasterDataProvider::lastError ( )
pure virtual

Returns the verbose error text for the last error in this provider.

If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the failure. Interactive users of this provider can then, for example, call a QMessageBox to display the contents.

◆ lastErrorFormat()

QString QgsRasterDataProvider::lastErrorFormat ( )
virtual

Returns the format of the error text for the last error in this provider.

Definition at line 355 of file qgsrasterdataprovider.cpp.

◆ lastErrorTitle()

virtual QString QgsRasterDataProvider::lastErrorTitle ( )
pure virtual

Returns the caption error text for the last error in this provider.

If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the failure. Interactive users of this provider can then, for example, call a QMessageBox to display the contents.

◆ maxOversampling()

double QgsRasterDataProvider::maxOversampling ( ) const
inline

Returns maximum oversampling factor for zoomed-out operations.

Since
QGIS 3.16

Definition at line 761 of file qgsrasterdataprovider.h.

◆ nativeResolutions()

QList< double > QgsRasterDataProvider::nativeResolutions ( ) const
virtual

Returns a list of native resolutions if available, i.e.

map units per pixel at which the raster source was originally created.

Resolutions are calculated in the provider's crs().

Since
QGIS 3.8.0

Definition at line 528 of file qgsrasterdataprovider.cpp.

◆ providerCapabilities()

QgsRasterDataProvider::ProviderCapabilities QgsRasterDataProvider::providerCapabilities ( ) const
virtual

Returns flags containing the supported capabilities of the data provider.

Since
QGIS 3.0

Definition at line 251 of file qgsrasterdataprovider.cpp.

◆ pyramidResamplingMethods()

QList< QPair< QString, QString > > QgsRasterDataProvider::pyramidResamplingMethods ( const QString &  providerKey)
static

Returns a list of pyramid resampling method name and label pairs for given provider.

Definition at line 377 of file qgsrasterdataprovider.cpp.

◆ readBlock() [1/2]

virtual bool QgsRasterDataProvider::readBlock ( int  bandNo,
int  xBlock,
int  yBlock,
void *  data 
)
inlineprotectedvirtual

Reads a block of raster data into data.

Returns
true if the block was successfully read, or false if an error occurred and the block could not be read.
Note
not available in Python bindings

Definition at line 848 of file qgsrasterdataprovider.h.

◆ readBlock() [2/2]

virtual bool QgsRasterDataProvider::readBlock ( int  bandNo,
QgsRectangle const &  viewExtent,
int  width,
int  height,
void *  data,
QgsRasterBlockFeedback feedback = nullptr 
)
inlineprotectedvirtual

Reads a block of raster data into data, using the given extent and size.

Returns
true if the block was successfully read, or false if an error occurred and the block could not be read.
Note
not available in Python bindings

Definition at line 856 of file qgsrasterdataprovider.h.

◆ readFileBasedAttributeTable()

bool QgsRasterDataProvider::readFileBasedAttributeTable ( int  bandNumber,
const QString &  path,
QString *  errorMessage = nullptr 
)

Loads the filesystem-based attribute table for the specified bandNumber from path, optionally reporting any error in errorMessage, returns true on success.

Returns
true on success
Since
QGIS 3.30

Definition at line 747 of file qgsrasterdataprovider.cpp.

◆ readNativeAttributeTable()

bool QgsRasterDataProvider::readNativeAttributeTable ( QString *  errorMessage = nullptr)
virtual

Reads the native attribute table, optionally reporting any error in errorMessage, returns true on success.

The default implementation does nothing and returns false. Data providers that have NativeRasterAttributeTable provider capability will try to read the native attribute table.

Returns
true on success
Since
QGIS 3.30

Definition at line 736 of file qgsrasterdataprovider.cpp.

◆ readXml()

void QgsRasterDataProvider::readXml ( const QDomElement &  filterElem)
overridevirtual

Sets base class members from xml. Usually called from create() methods of subclasses.

Reimplemented from QgsRasterInterface.

Definition at line 614 of file qgsrasterdataprovider.cpp.

◆ reload()

virtual bool QgsRasterDataProvider::reload ( )
inlinevirtual

Reload data (data could change)

Definition at line 225 of file qgsrasterdataprovider.h.

◆ remove()

virtual bool QgsRasterDataProvider::remove ( )
inlinevirtual

Remove dataset.

Definition at line 536 of file qgsrasterdataprovider.h.

◆ removeAttributeTable()

void QgsRasterDataProvider::removeAttributeTable ( int  bandNumber)

Remove the attribute table for the specified bandNumber.

If the attribute table does not exist this method does nothing.

Since
QGIS 3.30

Definition at line 709 of file qgsrasterdataprovider.cpp.

◆ sample()

double QgsRasterDataProvider::sample ( const QgsPointXY point,
int  band,
bool *  ok = nullptr,
const QgsRectangle boundingBox = QgsRectangle(),
int  width = 0,
int  height = 0,
int  dpi = 96 
)
virtual

Samples a raster value from the specified band found at the point position.

The context parameters boundingBox, width and height are important to identify on the same zoom level as a displayed map and to do effective caching (WCS). If context params are not specified the highest resolution is used.

If ok is specified and the point is outside data source extent, or an invalid band number was specified, then ok will be set to false. In this case the function will return a NaN value.

See also
identify(), which is much more flexible but considerably less efficient.
Since
QGIS 3.4

Definition at line 335 of file qgsrasterdataprovider.cpp.

◆ setAttributeTable()

void QgsRasterDataProvider::setAttributeTable ( int  bandNumber,
QgsRasterAttributeTable attributeTable 
)

Set the attribute table to attributeTable for the specified bandNumber, if the attributeTable is NULL any existing attribute table for the specified band will be removed.

Note
Ownership of the attribute table is transferred to the provider.
Since
QGIS 3.30

Definition at line 695 of file qgsrasterdataprovider.cpp.

◆ setDpi()

void QgsRasterDataProvider::setDpi ( int  dpi)
inline

Sets the output device resolution.

Definition at line 459 of file qgsrasterdataprovider.h.

◆ setEditable()

virtual bool QgsRasterDataProvider::setEditable ( bool  enabled)
inlinevirtual

Turns on/off editing mode of the provider.

When in editing mode, it is possible to overwrite data of the provider using writeBlock() calls.

Returns
true if the switch to/from editing mode was successful
Note
Only some providers support editing mode and even those may fail to turn the underlying data source into editing mode, so it is necessary to check the return value whether the operation was successful.
See also
isEditable(), writeBlock()
Since
QGIS 3.0

Definition at line 485 of file qgsrasterdataprovider.h.

◆ setInput()

bool QgsRasterDataProvider::setInput ( QgsRasterInterface input)
inlineoverridevirtual

Set input.

Returns true if set correctly, false if cannot use that input

Reimplemented from QgsRasterInterface.

Definition at line 136 of file qgsrasterdataprovider.h.

◆ setMaxOversampling()

virtual bool QgsRasterDataProvider::setMaxOversampling ( double  factor)
inlinevirtual

Sets maximum oversampling factor for zoomed-out operations.

Returns
true if success
Since
QGIS 3.16

Definition at line 755 of file qgsrasterdataprovider.h.

◆ setNoDataValue()

virtual bool QgsRasterDataProvider::setNoDataValue ( int  bandNo,
double  noDataValue 
)
inlinevirtual

Set no data value on created dataset.

Parameters
bandNoband number
noDataValueno data value

Definition at line 533 of file qgsrasterdataprovider.h.

◆ setUserNoDataValue()

void QgsRasterDataProvider::setUserNoDataValue ( int  bandNo,
const QgsRasterRangeList noData 
)
virtual

Definition at line 395 of file qgsrasterdataprovider.cpp.

◆ setUseSourceNoDataValue()

void QgsRasterDataProvider::setUseSourceNoDataValue ( int  bandNo,
bool  use 
)
virtual

Sets the source nodata value usage.

Definition at line 36 of file qgsrasterdataprovider.cpp.

◆ setZoomedInResamplingMethod()

virtual bool QgsRasterDataProvider::setZoomedInResamplingMethod ( ResamplingMethod  method)
inlinevirtual

Set resampling method to apply for zoomed-in operations.

Returns
true if success
Since
QGIS 3.16

Definition at line 727 of file qgsrasterdataprovider.h.

◆ setZoomedOutResamplingMethod()

virtual bool QgsRasterDataProvider::setZoomedOutResamplingMethod ( ResamplingMethod  method)
inlinevirtual

Set resampling method to apply for zoomed-out operations.

Returns
true if success
Since
QGIS 3.16

Definition at line 741 of file qgsrasterdataprovider.h.

◆ sourceDataType()

Qgis::DataType QgsRasterDataProvider::sourceDataType ( int  bandNo) const
overridepure virtual

Returns source data type for the band specified by number, source data type may be shorter than dataType.

Reimplemented from QgsRasterInterface.

◆ sourceHasNoDataValue()

virtual bool QgsRasterDataProvider::sourceHasNoDataValue ( int  bandNo) const
inlinevirtual

Returns true if source band has no data value.

Definition at line 247 of file qgsrasterdataprovider.h.

◆ sourceNoDataValue()

virtual double QgsRasterDataProvider::sourceNoDataValue ( int  bandNo) const
inlinevirtual

Value representing no data value.

Definition at line 256 of file qgsrasterdataprovider.h.

◆ statusChanged

void QgsRasterDataProvider::statusChanged ( const QString &  ) const
signal

Emit a message to be displayed on status bar, usually used by network providers (WMS,WCS)

Since
QGIS 2.14

◆ stepHeight()

virtual int QgsRasterDataProvider::stepHeight ( ) const
inlinevirtual

Step height for raster iterations.

See also
stepWidth()
Since
QGIS 3.0

Definition at line 638 of file qgsrasterdataprovider.h.

◆ stepWidth()

virtual int QgsRasterDataProvider::stepWidth ( ) const
inlinevirtual

Step width for raster iterations.

See also
stepHeight()
Since
QGIS 3.0

Definition at line 631 of file qgsrasterdataprovider.h.

◆ subLayers()

QStringList QgsRasterDataProvider::subLayers ( ) const
inlineoverridevirtual

Returns the sublayers of this layer - useful for providers that manage their own layers, such as WMS.

Reimplemented from QgsDataProvider.

Definition at line 270 of file qgsrasterdataprovider.h.

◆ supportsLegendGraphic()

virtual bool QgsRasterDataProvider::supportsLegendGraphic ( ) const
inlinevirtual

Returns whether the provider supplies a legend graphic.

Definition at line 279 of file qgsrasterdataprovider.h.

◆ temporalCapabilities() [1/2]

const QgsRasterDataProviderTemporalCapabilities * QgsRasterDataProvider::temporalCapabilities ( ) const
overridevirtual

Returns the provider's temporal capabilities.

This may be nullptr, depending on the data provider.

Since
QGIS 3.14

Reimplemented from QgsDataProvider.

Definition at line 430 of file qgsrasterdataprovider.cpp.

◆ temporalCapabilities() [2/2]

QgsRasterDataProviderTemporalCapabilities * QgsRasterDataProvider::temporalCapabilities ( )
overridevirtual

Returns the provider's temporal capabilities.

This may be nullptr, depending on the data provider.

Since
QGIS 3.14

Reimplemented from QgsDataProvider.

Definition at line 423 of file qgsrasterdataprovider.cpp.

◆ timestamp()

QDateTime QgsRasterDataProvider::timestamp ( ) const
inlineoverridevirtual

Time stamp of data source in the moment when data/metadata were loaded by provider.

Reimplemented from QgsDataProvider.

Definition at line 462 of file qgsrasterdataprovider.h.

◆ transformCoordinates()

QgsPoint QgsRasterDataProvider::transformCoordinates ( const QgsPoint point,
QgsRasterDataProvider::TransformType  type 
)
virtual

Transforms coordinates between source image coordinate space [0..width]x[0..height] and layer coordinate space (georeferenced coordinates).

Often this transformation is a simple 2D affine transformation (offset and scaling), but rasters with different georeferencing methods like GCPs (ground control points) or RPCs (rational polynomial coefficients) may require a more complex transform.

If the transform fails (input coordinates are outside of the valid range or data provider does not support this functionality), an empty point is returned.

Since
QGIS 3.14

Definition at line 542 of file qgsrasterdataprovider.cpp.

◆ userNoDataValues()

virtual QgsRasterRangeList QgsRasterDataProvider::userNoDataValues ( int  bandNo) const
inlinevirtual

Returns a list of user no data value ranges.

Definition at line 261 of file qgsrasterdataprovider.h.

◆ userNoDataValuesContains()

bool QgsRasterDataProvider::userNoDataValuesContains ( int  bandNo,
double  value 
) const
protected

Returns true if user no data contains value.

Definition at line 551 of file qgsrasterdataprovider.cpp.

◆ useSourceNoDataValue()

virtual bool QgsRasterDataProvider::useSourceNoDataValue ( int  bandNo) const
inlinevirtual

Returns the source nodata value usage.

Definition at line 250 of file qgsrasterdataprovider.h.

◆ validateCreationOptions()

virtual QString QgsRasterDataProvider::validateCreationOptions ( const QStringList &  createOptions,
const QString &  format 
)
inlinevirtual

Validates creation options for a specific dataset and destination format.

Note
used by GDAL provider only
see also validateCreationOptionsFormat() in gdal provider for validating options based on format only

Definition at line 591 of file qgsrasterdataprovider.h.

◆ validatePyramidsConfigOptions()

virtual QString QgsRasterDataProvider::validatePyramidsConfigOptions ( Qgis::RasterPyramidFormat  pyramidsFormat,
const QStringList &  configOptions,
const QString &  fileFormat 
)
inlinevirtual

Validates pyramid creation options for a specific dataset and destination format.

Note
used by GDAL provider only

Definition at line 598 of file qgsrasterdataprovider.h.

◆ write()

virtual bool QgsRasterDataProvider::write ( void *  data,
int  band,
int  width,
int  height,
int  xOffset,
int  yOffset 
)
inlinevirtual

Writes into the provider datasource.

Definition at line 490 of file qgsrasterdataprovider.h.

◆ writeBlock()

bool QgsRasterDataProvider::writeBlock ( QgsRasterBlock block,
int  band,
int  xOffset = 0,
int  yOffset = 0 
)

Writes pixel data from a raster block into the provider data source.

This will override previously stored pixel values. It is assumed that cells in the passed raster block are aligned with the cells of the data source. If raster block does not cover the whole area of the data source, only a subset of pixels covered by the raster block will be overwritten. By default, writing of raster data starts from the first cell of the raster - it is possible to set offset in pixels by specifying non-zero xOffset and yOffset values.

Writing is supported only by some data providers. Provider has to be in editing mode in order to allow write operations.

See also
isEditable(), setEditable()
Returns
true on success
Since
QGIS 3.0

Definition at line 362 of file qgsrasterdataprovider.cpp.

◆ writeFileBasedAttributeTable()

bool QgsRasterDataProvider::writeFileBasedAttributeTable ( int  bandNumber,
const QString &  path,
QString *  errorMessage = nullptr 
) const

Writes the filesystem-based attribute table for the specified bandNumber to path, optionally reporting any error in errorMessage, returns true on success.

Returns
true on success
Note
No checks for Raster Attribute Table validity are performed when saving, it is client code responsibility to handle validation.
Since
QGIS 3.30

Definition at line 719 of file qgsrasterdataprovider.cpp.

◆ writeNativeAttributeTable()

bool QgsRasterDataProvider::writeNativeAttributeTable ( QString *  errorMessage = nullptr)
virtual

Writes the native attribute table, optionally reporting any error in errorMessage, returns true on success.

The default implementation does nothing and returns false. Data providers that have NativeRasterAttributeTable provider capability will try to save the native attribute table.

Returns
true on success
Note
No checks for Raster Attribute Table validity are performed when saving, it is client code responsibility to handle validation.
Since
QGIS 3.30

Definition at line 763 of file qgsrasterdataprovider.cpp.

◆ writeXml()

void QgsRasterDataProvider::writeXml ( QDomDocument &  doc,
QDomElement &  parentElem 
) const
overridevirtual

Write base class members to xml.

Reimplemented from QgsRasterInterface.

Definition at line 658 of file qgsrasterdataprovider.cpp.

◆ zoomedInResamplingMethod()

ResamplingMethod QgsRasterDataProvider::zoomedInResamplingMethod ( ) const
inline

Returns resampling method for zoomed-in operations.

Since
QGIS 3.16

Definition at line 733 of file qgsrasterdataprovider.h.

◆ zoomedOutResamplingMethod()

ResamplingMethod QgsRasterDataProvider::zoomedOutResamplingMethod ( ) const
inline

Returns resampling method for zoomed-out operations.

Since
QGIS 3.16

Definition at line 747 of file qgsrasterdataprovider.h.

Member Data Documentation

◆ mDpi

int QgsRasterDataProvider::mDpi = -1
protected

Dots per inch.

Extended WMS (e.g. QGIS mapserver) support DPI dependent output and therefore are suited for printing. A value of -1 means it has not been set

Definition at line 869 of file qgsrasterdataprovider.h.

◆ mExtent

QgsRectangle QgsRasterDataProvider::mExtent
mutableprotected

Definition at line 896 of file qgsrasterdataprovider.h.

◆ mMaxOversampling

double QgsRasterDataProvider::mMaxOversampling = 2.0
protected

Maximum boundary for oversampling (to avoid too much data traffic). Default: 2.0.

Definition at line 908 of file qgsrasterdataprovider.h.

◆ mProviderResamplingEnabled

bool QgsRasterDataProvider::mProviderResamplingEnabled = false
protected

Whether provider resampling is enabled.

Definition at line 899 of file qgsrasterdataprovider.h.

◆ mSrcHasNoDataValue

QList<bool> QgsRasterDataProvider::mSrcHasNoDataValue
protected

Source no data value exists.

Definition at line 881 of file qgsrasterdataprovider.h.

◆ mSrcNoDataValue

QList<double> QgsRasterDataProvider::mSrcNoDataValue
protected

Source no data value is available and is set to be used or internal no data is available.

Used internally only

Cell value representing original source no data. e.g. -9999, indexed from 0

Definition at line 878 of file qgsrasterdataprovider.h.

◆ mUserNoDataValue

QList< QgsRasterRangeList > QgsRasterDataProvider::mUserNoDataValue
protected

List of lists of user defined additional no data values for each band, indexed from 0.

Definition at line 894 of file qgsrasterdataprovider.h.

◆ mUseSrcNoDataValue

QList<bool> QgsRasterDataProvider::mUseSrcNoDataValue
protected

Use source nodata value.

User can disable usage of source nodata value as nodata. It may happen that a value is wrongly given by GDAL as nodata (e.g. 0) and it has to be treated as regular value.

Definition at line 888 of file qgsrasterdataprovider.h.

◆ mZoomedInResamplingMethod

ResamplingMethod QgsRasterDataProvider::mZoomedInResamplingMethod = ResamplingMethod::Nearest
protected

Resampling method for zoomed in pixel extraction.

Definition at line 902 of file qgsrasterdataprovider.h.

◆ mZoomedOutResamplingMethod

ResamplingMethod QgsRasterDataProvider::mZoomedOutResamplingMethod = ResamplingMethod::Nearest
protected

Resampling method for zoomed out pixel extraction.

Definition at line 905 of file qgsrasterdataprovider.h.


The documentation for this class was generated from the following files: