QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
Base class for raster data providers. More...
#include <qgsrasterdataprovider.h>
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 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 | ProviderProperty { EvaluateDefaultValues , CustomData = 3000 } |
Properties are used to pass custom configuration options into data providers. More... | |
Signals | |
void | statusChanged (const QString &) const |
Emit a message to be displayed on status bar, usually used by network providers (WMS,WCS) | |
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. | |
void | fullExtentCalculated () |
Emitted whenever a deferred extent calculation is completed by the provider. | |
void | notify (const QString &msg) |
Emitted when the datasource issues a notification. | |
Public Member Functions | |
QgsRasterDataProvider () | |
QgsRasterDataProvider (const QString &uri, const QgsDataProvider::ProviderOptions &providerOptions=QgsDataProvider::ProviderOptions(), Qgis::DataProviderReadFlags flags=Qgis::DataProviderReadFlags()) | |
Constructor for QgsRasterDataProvider. | |
QgsRasterAttributeTable * | attributeTable (int bandNumber) const |
Returns the (possibly nullptr ) attribute table for the specified bandNumber. | |
virtual QString | bandDescription (int bandNumber) |
Returns the description for band bandNumber, or an empty string if the band is not valid or has not description. | |
virtual double | bandOffset (int bandNo) const |
Read band offset for raster value. | |
virtual double | bandScale (int bandNo) const |
Read band scale for raster value. | |
QgsRasterBlock * | block (int bandNo, const QgsRectangle &boundingBox, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override |
Read block of data using given extent and size. | |
virtual QList< QgsRasterPyramid > | buildPyramidList (const QList< int > &overviewList=QList< int >()) |
Returns the raster layers pyramid list. | |
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. | |
QgsRasterDataProvider * | clone () const override=0 |
Clone itself, create deep copy. | |
virtual Qgis::RasterColorInterpretation | colorInterpretation (int bandNo) const |
Returns data type for the band specified by number. | |
QString | colorInterpretationName (int bandNo) const override |
Returns the name of the color interpretation for the specified bandNumber. | |
QString | colorName (Qgis::RasterColorInterpretation colorInterpretation) const |
Returns a string color name representation of a color interpretation. | |
virtual QList< QgsColorRampShader::ColorRampItem > | colorTable (int bandNo) const |
QDateTime | dataTimestamp () const override |
Current time stamp of data source. | |
Qgis::DataType | dataType (int bandNo) const override=0 |
Returns data type for the band specified by number. | |
int | dpi () const |
Returns the dpi of the output device. | |
const QgsRasterDataProviderElevationProperties * | elevationProperties () const override |
Returns the provider's elevation properties. | |
QgsRasterDataProviderElevationProperties * | elevationProperties () override |
Returns the provider's elevation properties. | |
virtual bool | enableProviderResampling (bool enable) |
Enable or disable provider-level resampling. | |
QgsRectangle | extent () const override=0 |
Returns the extent of the layer. | |
virtual QgsFields | fields () const |
Returns the fields of the raster layer for data providers that expose them, the default implementation returns an empty list. | |
virtual QImage | getLegendGraphic (double scale=0, bool forceRefresh=false, const QgsRectangle *visibleExtent=nullptr) |
Returns the legend rendered as pixmap. | |
virtual QgsImageFetcher * | getLegendGraphicFetcher (const QgsMapSettings *mapSettings) |
Returns a new image downloader for the raster legend. | |
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 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. | |
virtual bool | isEditable () const |
Checks whether the provider is in editing mode, i.e. | |
bool | isProviderResamplingEnabled () const |
Returns whether provider-level resampling is enabled. | |
virtual QString | lastError ()=0 |
Returns the verbose error text for the last error in this provider. | |
virtual QString | lastErrorFormat () |
Returns the format of the error text for the last error in this provider. | |
virtual QString | lastErrorTitle ()=0 |
Returns the caption error text for the last error in this provider. | |
virtual QSize | maximumTileSize () const |
Returns the maximum tile size in pixels for the data provider. | |
double | maxOversampling () const |
Returns maximum oversampling factor for zoomed-out operations. | |
virtual QList< double > | nativeResolutions () const |
Returns a list of native resolutions if available, i.e. | |
virtual Qgis::RasterProviderCapabilities | providerCapabilities () const |
Returns flags containing the supported capabilities of the data provider. | |
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. | |
virtual bool | readNativeAttributeTable (QString *errorMessage=nullptr) |
Reads the native attribute table, optionally reporting any error in errorMessage, returns true on success. | |
void | readXml (const QDomElement &filterElem) override |
Sets base class members from xml. Usually called from create() methods of subclasses. | |
virtual bool | reload () |
Reload data (data could change) | |
virtual bool | remove () |
Remove dataset. | |
void | removeAttributeTable (int bandNumber) |
Remove the attribute table for the specified bandNumber. | |
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. | |
void | setAttributeTable (int bandNumber, QgsRasterAttributeTable *attributeTable) |
Set the attribute table to attributeTable for the specified bandNumber, if the attributeTable is nullptr any existing attribute table for the specified band will be removed. | |
void | setDpi (int dpi) |
Sets the output device resolution. | |
virtual bool | setEditable (bool enabled) |
Turns on/off editing mode of the provider. | |
bool | setInput (QgsRasterInterface *input) override |
Set input. | |
virtual bool | setMaxOversampling (double factor) |
Sets maximum oversampling factor for zoomed-out operations. | |
virtual bool | setNoDataValue (int bandNo, double noDataValue) |
Set no data value on created dataset. | |
virtual void | setUserNoDataValue (int bandNo, const QgsRasterRangeList &noData) |
virtual void | setUseSourceNoDataValue (int bandNo, bool use) |
Sets the source nodata value usage. | |
virtual bool | setZoomedInResamplingMethod (ResamplingMethod method) |
Set resampling method to apply for zoomed-in operations. | |
virtual bool | setZoomedOutResamplingMethod (ResamplingMethod method) |
Set resampling method to apply for zoomed-out operations. | |
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. | |
virtual bool | sourceHasNoDataValue (int bandNo) const |
Returns true if source band has no data value. | |
virtual double | sourceNoDataValue (int bandNo) const |
Value representing no data value. | |
virtual int | stepHeight () const |
Step height for raster iterations. | |
virtual int | stepWidth () const |
Step width for raster iterations. | |
QStringList | subLayers () const override |
Returns the sublayers of this layer - useful for providers that manage their own layers, such as WMS. | |
virtual bool | supportsLegendGraphic () const |
Returns whether the provider supplies a legend graphic. | |
const QgsRasterDataProviderTemporalCapabilities * | temporalCapabilities () const override |
Returns the provider's temporal capabilities. | |
QgsRasterDataProviderTemporalCapabilities * | temporalCapabilities () override |
Returns the provider's temporal capabilities. | |
QDateTime | timestamp () const override |
Time stamp of data source in the moment when data/metadata were loaded by provider. | |
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). | |
virtual QgsRasterRangeList | userNoDataValues (int bandNo) const |
Returns a list of user no data value ranges. | |
virtual bool | useSourceNoDataValue (int bandNo) const |
Returns the source nodata value usage. | |
virtual QString | validateCreationOptions (const QStringList &createOptions, const QString &format) |
Validates creation options for a specific dataset and destination format. | |
virtual QString | validatePyramidsConfigOptions (Qgis::RasterPyramidFormat pyramidsFormat, const QStringList &configOptions, const QString &fileFormat) |
Validates pyramid creation options for a specific dataset and destination format. | |
virtual bool | write (const void *data, int band, int width, int height, int xOffset, int yOffset) |
Writes into the provider datasource. | |
bool | writeBlock (QgsRasterBlock *block, int band, int xOffset=0, int yOffset=0) |
Writes pixel data from a raster block into the provider data source. | |
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. | |
virtual bool | writeNativeAttributeTable (QString *errorMessage=nullptr) |
Writes the native attribute table, optionally reporting any error in errorMessage, returns true on success. | |
void | writeXml (QDomDocument &doc, QDomElement &parentElem) const override |
Write base class members to xml. | |
ResamplingMethod | zoomedInResamplingMethod () const |
Returns resampling method for zoomed-in operations. | |
ResamplingMethod | zoomedOutResamplingMethod () const |
Returns resampling method for zoomed-out operations. | |
Public Member Functions inherited from QgsDataProvider | |
QgsDataProvider (const QString &uri=QString(), const QgsDataProvider::ProviderOptions &providerOptions=QgsDataProvider::ProviderOptions(), Qgis::DataProviderReadFlags flags=Qgis::DataProviderReadFlags()) | |
Create a new dataprovider with the specified in the uri. | |
virtual QgsCoordinateReferenceSystem | crs () const =0 |
Returns the coordinate system for the data source. | |
virtual QString | dataComment () const |
Returns a short comment for the data that this provider is providing access to (e.g. | |
virtual QString | dataSourceUri (bool expandAuthConfig=false) const |
Gets the data source specification. | |
virtual QString | description () const =0 |
Returns description. | |
virtual bool | enterUpdateMode () |
Enter update mode. | |
virtual QgsError | error () const |
Gets current status error. | |
virtual QgsBox3D | extent3D () const |
Returns the 3D extent of the layer. | |
virtual QString | fileRasterFilters () const |
Returns raster file filter string. | |
virtual QString | fileVectorFilters () const |
Returns vector file filter string. | |
virtual Qgis::DataProviderFlags | flags () const |
Returns the generic data provider flags. | |
virtual QString | htmlMetadata () const |
Obtain a formatted HTML string containing assorted metadata for this data provider. | |
virtual void | invalidateConnections (const QString &connection) |
Invalidate connections corresponding to specified name. | |
virtual bool | isValid () const =0 |
Returns true if this is a valid layer. | |
virtual QgsLayerMetadata | layerMetadata () const |
Returns layer metadata collected from the provider's source. | |
virtual bool | leaveUpdateMode () |
Leave update mode. | |
virtual QString | name () const =0 |
Returns a provider name. | |
QVariant | providerProperty (int property, const QVariant &defaultValue) const |
Gets the current value of a certain provider property. | |
QVariant | providerProperty (ProviderProperty property, const QVariant &defaultValue=QVariant()) const |
Gets the current value of a certain provider property. | |
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. | |
virtual bool | renderInPreview (const QgsDataProvider::PreviewContext &context) |
Returns whether the layer must be rendered in preview jobs. | |
virtual void | setDataSourceUri (const QString &uri) |
Set the data source specification. | |
virtual void | setLayerOrder (const QStringList &layers) |
Reorder the list of layer names to be rendered by this provider (in order from bottom to top) | |
virtual void | setListening (bool isListening) |
Set whether the provider will listen to datasource notifications If set, the provider will issue notify signals. | |
void | setProviderProperty (int property, const QVariant &value) |
Allows setting arbitrary properties on the provider. | |
void | setProviderProperty (ProviderProperty property, const QVariant &value) |
Allows setting arbitrary properties on the provider. | |
virtual void | setSubLayerVisibility (const QString &name, bool vis) |
Set the visibility of the given sublayer name. | |
virtual bool | setSubsetString (const QString &subset, bool updateFeatureCount=true) |
Set the subset string used to create a subset of features in the layer. | |
virtual void | setTransformContext (const QgsCoordinateTransformContext &transformContext) |
Sets data coordinate transform context to transformContext. | |
void | setUri (const QgsDataSourceUri &uri) |
Set the data source specification. | |
void | setUri (const QString &uri) |
Set the data source specification. | |
virtual Qgis::ProviderStyleStorageCapabilities | styleStorageCapabilities () const |
Returns the style storage capabilities. | |
virtual uint | subLayerCount () const |
Returns the number of layers for the current data source. | |
virtual QStringList | subLayerStyles () const |
Sub-layer styles for each sub-layer handled by this provider, in order from bottom to top. | |
virtual QString | subsetString () const |
Returns the subset definition string currently in use by the layer and used by the provider to limit the feature set. | |
virtual QString | subsetStringDialect () const |
Returns a user-friendly string describing the dialect which is supported for subset strings by the provider. | |
virtual QString | subsetStringHelpUrl () const |
Returns a URL pointing to documentation describing the dialect which is supported for subset strings by the provider. | |
virtual bool | supportsSubsetString () const |
Returns true if the provider supports setting of subset strings. | |
QgsCoordinateTransformContext | transformContext () const |
Returns data provider coordinate transform context. | |
virtual void | updateExtents () |
Update the extents of the layer. | |
QgsDataSourceUri | uri () const |
Gets the data source specification. | |
virtual bool | writeLayerMetadata (const QgsLayerMetadata &metadata) |
Writes layer metadata to the underlying provider source. | |
Public Member Functions inherited from QgsRasterInterface | |
QgsRasterInterface (QgsRasterInterface *input=nullptr) | |
virtual | ~QgsRasterInterface ()=default |
virtual int | bandCount () const =0 |
Gets number of bands. | |
Q_DECL_DEPRECATED QgsRasterBandStats | bandStatistics (int bandNo, int stats, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, QgsRasterBlockFeedback *feedback=nullptr) |
Returns the band statistics. | |
virtual QgsRasterBandStats | bandStatistics (int bandNo, Qgis::RasterBandStatistics stats=Qgis::RasterBandStatistic::All, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, QgsRasterBlockFeedback *feedback=nullptr) |
Returns the band statistics. | |
virtual Qgis::RasterInterfaceCapabilities | capabilities () const |
Returns the capabilities supported by the interface. | |
Q_DECL_DEPRECATED QString | capabilitiesString () const |
Returns the raster interface capabilities in friendly format. | |
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. | |
int | dataTypeSize (int bandNo) const |
Returns the size (in bytes) for the data type for the specified band. | |
QString | displayBandName (int bandNumber) const |
Generates a friendly, descriptive name for the specified bandNumber. | |
virtual QString | generateBandName (int bandNumber) const |
helper function to create zero padded band names | |
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) | |
Q_DECL_DEPRECATED bool | hasStatistics (int bandNo, int stats, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0) |
Returns true if histogram is available (cached, already calculated). | |
virtual bool | hasStatistics (int bandNo, Qgis::RasterBandStatistics stats=Qgis::RasterBandStatistic::All, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0) |
Returns true if histogram is available (cached, already calculated). | |
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. | |
virtual QgsRasterInterface * | input () const |
Current input. | |
virtual bool | on () const |
Returns whether the interface is on or off. | |
virtual void | setOn (bool on) |
Sets whether the interface is on or off. | |
virtual QgsRasterInterface * | sourceInput () |
Gets source / raw input, the first in pipe, usually provider. | |
virtual const QgsRasterInterface * | sourceInput () const |
Gets source / raw input, the first in pipe, usually provider. | |
virtual int | xBlockSize () const |
Gets block size. | |
virtual int | xSize () const |
Gets raster size. | |
virtual int | yBlockSize () const |
virtual int | ySize () const |
Static Public Member Functions | |
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. | |
static QgsRasterDataProvider::VirtualRasterParameters | decodeVirtualRasterProviderUri (const QString &uri, bool *ok=nullptr) |
Decodes the URI returning a struct with all the parameters for QgsVirtualRasterProvider class. | |
static QString | encodeVirtualRasterProviderUri (const VirtualRasterParameters &parts) |
Encodes the URI starting from the struct . | |
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. | |
static QString | identifyFormatName (Qgis::RasterIdentifyFormat format) |
Converts a raster identify format to a string name. | |
static Qgis::RasterInterfaceCapability | identifyFormatToCapability (Qgis::RasterIdentifyFormat format) |
Converts a raster identify format to a capability. | |
static QList< QPair< QString, QString > > | pyramidResamplingMethods (const QString &providerKey) |
Returns a list of pyramid resampling method name and label pairs for given provider. | |
Static Public Member Functions inherited from QgsDataProvider | |
static QString | sublayerSeparator () |
String sequence used for separating components of sublayers strings. | |
Protected Member Functions | |
void | copyBaseSettings (const QgsRasterDataProvider &other) |
Copy member variables from other raster data provider. Useful for implementation of clone() method in subclasses. | |
virtual bool | readBlock (int bandNo, int xBlock, int yBlock, void *data) |
Reads a block of raster data into data. | |
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. | |
bool | userNoDataValuesContains (int bandNo, double value) const |
Returns true if user no data contains value. | |
Protected Member Functions inherited from QgsDataProvider | |
void | appendError (const QgsErrorMessage &message) |
Add error message. | |
void | setError (const QgsError &error) |
Sets error message. | |
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. | |
Q_DECL_DEPRECATED void | initStatistics (QgsRasterBandStats &statistics, int bandNo, int stats, const QgsRectangle &boundingBox=QgsRectangle(), int binCount=0) const |
Fill in statistics defaults if not specified. | |
void | initStatistics (QgsRasterBandStats &statistics, int bandNo, Qgis::RasterBandStatistics stats=Qgis::RasterBandStatistic::All, const QgsRectangle &boundingBox=QgsRectangle(), int binCount=0) const |
Fill in statistics defaults if not specified. | |
Protected Attributes | |
int | mDpi = -1 |
Dots per inch. | |
QgsRectangle | mExtent |
double | mMaxOversampling = 2.0 |
Maximum boundary for oversampling (to avoid too much data traffic). Default: 2.0. | |
bool | mProviderResamplingEnabled = false |
Whether provider resampling is enabled. | |
QList< bool > | mSrcHasNoDataValue |
Source no data value exists. | |
QList< double > | mSrcNoDataValue |
Source no data value is available and is set to be used or internal no data is available. | |
QList< QgsRasterRangeList > | mUserNoDataValue |
List of lists of user defined additional no data values for each band, indexed from 0. | |
QList< bool > | mUseSrcNoDataValue |
Use source nodata value. | |
ResamplingMethod | mZoomedInResamplingMethod = ResamplingMethod::Nearest |
Resampling method for zoomed in pixel extraction. | |
ResamplingMethod | mZoomedOutResamplingMethod = ResamplingMethod::Nearest |
Resampling method for zoomed out pixel extraction. | |
Protected Attributes inherited from QgsDataProvider | |
QgsError | mError |
Error. | |
Qgis::DataProviderReadFlags | mReadFlags |
Read flags. It's up to the subclass to respect these when needed. | |
QDateTime | mTimestamp |
Timestamp of data in the moment when the data were loaded by provider. | |
Protected Attributes inherited from QgsRasterInterface | |
QList< QgsRasterHistogram > | mHistograms |
List of cached histograms, all bands mixed. | |
QgsRasterInterface * | mInput = nullptr |
bool | mOn = true |
QList< QgsRasterBandStats > | mStatistics |
List of cached statistics, all bands mixed. | |
Base class for raster data providers.
Definition at line 88 of file qgsrasterdataprovider.h.
|
strong |
Resampling method for provider-level resampling.
Definition at line 630 of file qgsrasterdataprovider.h.
Types of transformation in transformCoordinates() function.
Enumerator | |
---|---|
TransformImageToLayer | Transforms image coordinates to layer (georeferenced) coordinates. |
TransformLayerToImage | Transforms layer (georeferenced) coordinates to image coordinates. |
Definition at line 583 of file qgsrasterdataprovider.h.
QgsRasterDataProvider::QgsRasterDataProvider | ( | ) |
Definition at line 236 of file qgsrasterdataprovider.cpp.
QgsRasterDataProvider::QgsRasterDataProvider | ( | const QString & | uri, |
const QgsDataProvider::ProviderOptions & | providerOptions = QgsDataProvider::ProviderOptions() , |
||
Qgis::DataProviderReadFlags | flags = Qgis::DataProviderReadFlags() |
||
) |
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 245 of file qgsrasterdataprovider.cpp.
QgsRasterAttributeTable * QgsRasterDataProvider::attributeTable | ( | int | bandNumber | ) | const |
Returns the (possibly nullptr
) attribute table for the specified bandNumber.
Definition at line 701 of file qgsrasterdataprovider.cpp.
|
virtual |
Returns the description for band bandNumber, or an empty string if the band is not valid or has not description.
The default implementation returns an empty string.
Definition at line 767 of file qgsrasterdataprovider.cpp.
|
inlinevirtual |
Read band offset for raster value.
Definition at line 158 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Read band scale for raster value.
Definition at line 153 of file qgsrasterdataprovider.h.
|
overridevirtual |
Read block of data using given extent and size.
Implements QgsRasterInterface.
Definition at line 51 of file qgsrasterdataprovider.cpp.
|
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().
overviewList | used to construct the pyramid list (optional), when empty the list is defined by the provider. |
Definition at line 296 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Creates pyramid overviews.
pyramidList | a list of QgsRasterPyramids to create overviews for. The QgsRasterPyramid::setBuild() flag should be set to true for every layer where pyramids are desired. |
resamplingMethod | resampling 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. |
format | raster pyramid format. |
configOptions | optional configuration options which are passed to the specific data provider for use during pyramid creation. |
feedback | optional feedback argument for progress reports and cancellation support. |
Definition at line 264 of file qgsrasterdataprovider.h.
|
overridepure virtual |
Clone itself, create deep copy.
Implements QgsRasterInterface.
|
virtual |
Returns data type for the band specified by number.
Definition at line 261 of file qgsrasterdataprovider.cpp.
|
overridevirtual |
Returns the name of the color interpretation for the specified bandNumber.
It is translated since QGIS 3.40
Reimplemented from QgsRasterInterface.
Definition at line 797 of file qgsrasterdataprovider.cpp.
QString QgsRasterDataProvider::colorName | ( | Qgis::RasterColorInterpretation | colorInterpretation | ) | const |
Returns a string color name representation of a color interpretation.
It is translated since QGIS 3.40
Definition at line 804 of file qgsrasterdataprovider.cpp.
|
inlinevirtual |
Definition at line 191 of file qgsrasterdataprovider.h.
|
protected |
Copy member variables from other raster data provider. Useful for implementation of clone() method in subclasses.
Definition at line 576 of file qgsrasterdataprovider.cpp.
|
static |
Creates a new dataset with mDataSourceURI.
Definition at line 454 of file qgsrasterdataprovider.cpp.
|
inlineoverridevirtual |
Current time stamp of data source.
Reimplemented from QgsDataProvider.
Definition at line 388 of file qgsrasterdataprovider.h.
|
overridepure virtual |
Returns data type for the band specified by number.
Implements QgsRasterInterface.
|
static |
Decodes the URI returning a struct with all the parameters for QgsVirtualRasterProvider class.
Definition at line 917 of file qgsrasterdataprovider.cpp.
|
inline |
Returns the dpi of the output device.
Definition at line 379 of file qgsrasterdataprovider.h.
|
overridevirtual |
Returns the provider's elevation properties.
This may be nullptr
, depending on the data provider.
Reimplemented from QgsDataProvider.
Definition at line 447 of file qgsrasterdataprovider.cpp.
|
overridevirtual |
Returns the provider's elevation properties.
This may be nullptr
, depending on the data provider.
Reimplemented from QgsDataProvider.
Definition at line 440 of file qgsrasterdataprovider.cpp.
|
inlinevirtual |
Enable or disable provider-level resampling.
true
if success Definition at line 610 of file qgsrasterdataprovider.h.
|
static |
Encodes the URI starting from the struct .
Definition at line 1018 of file qgsrasterdataprovider.cpp.
|
overridepure virtual |
Returns the extent of the layer.
Implements QgsDataProvider.
|
inlinevirtual |
Returns the fields of the raster layer for data providers that expose them, the default implementation returns an empty list.
Definition at line 128 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Returns the legend rendered as pixmap.
This is useful for layers which need to get legend layers remotely as WMS.
scale | Optional parameter that is the Scale of the layer |
forceRefresh | Optional bool parameter to force refresh getLegendGraphic call |
visibleExtent | Visible extent for providers supporting contextual legends, in layer CRS |
Definition at line 222 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Returns a new image downloader for the raster legend.
mapSettings | map settings for legend providers supporting contextual legends. |
nullptr
if the provider does not support legend at all. Ownership of the returned object is transferred to caller. Definition at line 242 of file qgsrasterdataprovider.h.
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.
Definition at line 390 of file qgsrasterdataprovider.cpp.
|
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.
point | coordinates in data source CRS |
format | result format |
boundingBox | context bounding box |
width | context width |
height | context height |
dpi | context dpi |
Definition at line 272 of file qgsrasterdataprovider.cpp.
|
static |
Converts a string formatName to a raster identify format.
Definition at line 514 of file qgsrasterdataprovider.cpp.
|
static |
Converts a raster identify format to a translated string label.
Definition at line 496 of file qgsrasterdataprovider.cpp.
|
static |
Converts a raster identify format to a string name.
Definition at line 478 of file qgsrasterdataprovider.cpp.
|
static |
Converts a raster identify format to a capability.
Definition at line 527 of file qgsrasterdataprovider.cpp.
|
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.
Definition at line 552 of file qgsrasterdataprovider.cpp.
|
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.
Definition at line 396 of file qgsrasterdataprovider.h.
|
inline |
Returns whether provider-level resampling is enabled.
Definition at line 624 of file qgsrasterdataprovider.h.
|
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.
|
virtual |
Returns the format of the error text for the last error in this provider.
Definition at line 358 of file qgsrasterdataprovider.cpp.
|
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.
|
inlinevirtual |
Returns the maximum tile size in pixels for the data provider.
By default, the maximum tile size is set to QgsRasterIterator::DEFAULT_MAXIMUM_TILE_WIDTH x QgsRasterIterator::DEFAULT_MAXIMUM_TILE_HEIGHT but can be overridden in subclasses (e.g. WMS can retrieve that information from the GetCapabilities document).
Definition at line 167 of file qgsrasterdataprovider.h.
|
inline |
Returns maximum oversampling factor for zoomed-out operations.
Definition at line 682 of file qgsrasterdataprovider.h.
|
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().
Definition at line 545 of file qgsrasterdataprovider.cpp.
|
virtual |
Returns flags containing the supported capabilities of the data provider.
Definition at line 254 of file qgsrasterdataprovider.cpp.
|
static |
Returns a list of pyramid resampling method name and label pairs for given provider.
Definition at line 380 of file qgsrasterdataprovider.cpp.
|
inlineprotectedvirtual |
Reads a block of raster data into data.
true
if the block was successfully read, or false
if an error occurred and the block could not be read. Definition at line 776 of file qgsrasterdataprovider.h.
|
inlineprotectedvirtual |
Reads a block of raster data into data, using the given extent and size.
true
if the block was successfully read, or false
if an error occurred and the block could not be read. Definition at line 784 of file qgsrasterdataprovider.h.
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.
true
on success Definition at line 773 of file qgsrasterdataprovider.cpp.
|
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.
true
on success Definition at line 756 of file qgsrasterdataprovider.cpp.
|
overridevirtual |
Sets base class members from xml. Usually called from create() methods of subclasses.
Reimplemented from QgsRasterInterface.
Definition at line 634 of file qgsrasterdataprovider.cpp.
|
inlinevirtual |
Reload data (data could change)
Definition at line 146 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Remove dataset.
Definition at line 459 of file qgsrasterdataprovider.h.
void QgsRasterDataProvider::removeAttributeTable | ( | int | bandNumber | ) |
Remove the attribute table for the specified bandNumber.
If the attribute table does not exist this method does nothing.
Definition at line 729 of file qgsrasterdataprovider.cpp.
|
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.
Definition at line 338 of file qgsrasterdataprovider.cpp.
void QgsRasterDataProvider::setAttributeTable | ( | int | bandNumber, |
QgsRasterAttributeTable * | attributeTable | ||
) |
Set the attribute table to attributeTable for the specified bandNumber, if the attributeTable is nullptr
any existing attribute table for the specified band will be removed.
Definition at line 715 of file qgsrasterdataprovider.cpp.
|
inline |
Sets the output device resolution.
Definition at line 382 of file qgsrasterdataprovider.h.
|
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.
true
if the switch to/from editing mode was successful Definition at line 408 of file qgsrasterdataprovider.h.
|
inlineoverridevirtual |
Set input.
Returns true
if set correctly, false
if cannot use that input
Reimplemented from QgsRasterInterface.
Definition at line 116 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Sets maximum oversampling factor for zoomed-out operations.
true
if success Definition at line 676 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Set no data value on created dataset.
bandNo | band number |
noDataValue | no data value |
Definition at line 456 of file qgsrasterdataprovider.h.
|
virtual |
Definition at line 398 of file qgsrasterdataprovider.cpp.
|
virtual |
Sets the source nodata value usage.
Definition at line 37 of file qgsrasterdataprovider.cpp.
|
inlinevirtual |
Set resampling method to apply for zoomed-in operations.
true
if success Definition at line 648 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Set resampling method to apply for zoomed-out operations.
true
if success Definition at line 662 of file qgsrasterdataprovider.h.
|
overridepure virtual |
Returns source data type for the band specified by number, source data type may be shorter than dataType.
Reimplemented from QgsRasterInterface.
|
inlinevirtual |
Returns true
if source band has no data value.
Definition at line 175 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Value representing no data value.
Definition at line 184 of file qgsrasterdataprovider.h.
|
signal |
Emit a message to be displayed on status bar, usually used by network providers (WMS,WCS)
|
inlinevirtual |
Step height for raster iterations.
Definition at line 559 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Step width for raster iterations.
Definition at line 553 of file qgsrasterdataprovider.h.
|
inlineoverridevirtual |
Returns the sublayers of this layer - useful for providers that manage their own layers, such as WMS.
Reimplemented from QgsDataProvider.
Definition at line 198 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Returns whether the provider supplies a legend graphic.
Definition at line 209 of file qgsrasterdataprovider.h.
|
overridevirtual |
Returns the provider's temporal capabilities.
This may be nullptr
, depending on the data provider.
Reimplemented from QgsDataProvider.
Definition at line 433 of file qgsrasterdataprovider.cpp.
|
overridevirtual |
Returns the provider's temporal capabilities.
This may be nullptr
, depending on the data provider.
Reimplemented from QgsDataProvider.
Definition at line 426 of file qgsrasterdataprovider.cpp.
|
inlineoverridevirtual |
Time stamp of data source in the moment when data/metadata were loaded by provider.
Reimplemented from QgsDataProvider.
Definition at line 385 of file qgsrasterdataprovider.h.
|
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.
Definition at line 559 of file qgsrasterdataprovider.cpp.
|
inlinevirtual |
Returns a list of user no data value ranges.
Definition at line 189 of file qgsrasterdataprovider.h.
|
protected |
Returns true
if user no data contains value.
Definition at line 568 of file qgsrasterdataprovider.cpp.
|
inlinevirtual |
Returns the source nodata value usage.
Definition at line 178 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Validates creation options for a specific dataset and destination format.
Definition at line 514 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Validates pyramid creation options for a specific dataset and destination format.
Definition at line 521 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Writes into the provider datasource.
Definition at line 413 of file qgsrasterdataprovider.h.
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.
true
on success Definition at line 365 of file qgsrasterdataprovider.cpp.
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.
true
on success Definition at line 739 of file qgsrasterdataprovider.cpp.
|
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.
true
on success Definition at line 789 of file qgsrasterdataprovider.cpp.
|
overridevirtual |
Write base class members to xml.
Reimplemented from QgsRasterInterface.
Definition at line 678 of file qgsrasterdataprovider.cpp.
|
inline |
Returns resampling method for zoomed-in operations.
Definition at line 654 of file qgsrasterdataprovider.h.
|
inline |
Returns resampling method for zoomed-out operations.
Definition at line 668 of file qgsrasterdataprovider.h.
|
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 797 of file qgsrasterdataprovider.h.
|
mutableprotected |
Definition at line 824 of file qgsrasterdataprovider.h.
|
protected |
Maximum boundary for oversampling (to avoid too much data traffic). Default: 2.0.
Definition at line 836 of file qgsrasterdataprovider.h.
|
protected |
Whether provider resampling is enabled.
Definition at line 827 of file qgsrasterdataprovider.h.
|
protected |
Source no data value exists.
Definition at line 809 of file qgsrasterdataprovider.h.
|
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 806 of file qgsrasterdataprovider.h.
|
protected |
List of lists of user defined additional no data values for each band, indexed from 0.
Definition at line 822 of file qgsrasterdataprovider.h.
|
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 816 of file qgsrasterdataprovider.h.
|
protected |
Resampling method for zoomed in pixel extraction.
Definition at line 830 of file qgsrasterdataprovider.h.
|
protected |
Resampling method for zoomed out pixel extraction.
Definition at line 833 of file qgsrasterdataprovider.h.