Class: QgsRasterDataProvider

class qgis.core.QgsRasterDataProvider

Bases: QgsDataProvider, QgsRasterInterface

Base class for raster data providers.

QgsRasterDataProvider()

QgsRasterDataProvider(uri: str, providerOptions: QgsDataProvider.ProviderOptions = QgsDataProvider.ProviderOptions(), flags: Union[QgsDataProvider.ReadFlags, QgsDataProvider.ReadFlag] = 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.

Enums

ResamplingMethod

Bases: enum.IntEnum

Methods

appendError

Add error message

attributeTable

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

bandDescription

param bandNumber:

bandOffset

Read band offset for raster value

bandScale

Read band scale for raster value

block

Read block of data using given extent and size.

buildPyramidList

Returns the raster layers pyramid list.

buildPyramids

Creates pyramid overviews.

childEvent

clone

rtype:

QgsRasterDataProvider

colorInterpretation

Returns data type for the band specified by number

colorInterpretationName

param bandNo:

colorName

Returns a string color name representation of a color interpretation.

colorTable

param bandNo:

connectNotify

copyBaseSettings

Copy member variables from other raster data provider.

create

Creates a new dataset with mDataSourceURI

customEvent

dataTimestamp

Current time stamp of data source

dataType

Returns data type for the band specified by number

decodeVirtualRasterProviderUri

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

disconnectNotify

dpi

Returns the dpi of the output device.

elevationProperties

rtype:

QgsRasterDataProviderElevationProperties

enableProviderResampling

Enable or disable provider-level resampling.

encodeVirtualRasterProviderUri

Encodes the URI starting from the struct .

extent

rtype:

QgsRectangle

fields

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

getLegendGraphicFetcher

Returns a new image downloader for the raster legend.

hasPyramids

Returns True if raster has at least one existing pyramid.

identify

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

identifyFormatFromName

Converts a string formatName to a raster identify format.

identifyFormatLabel

Converts a raster identify format to a translated string label.

identifyFormatName

Converts a raster identify format to a string name.

identifyFormatToCapability

Converts a raster identify format to a capability.

ignoreExtents

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.

initHistogram

Fill in histogram defaults if not specified

initStatistics

Fill in statistics defaults if not specified

isEditable

Checks whether the provider is in editing mode, i.e. raster write operations will be accepted.

isProviderResamplingEnabled

Returns whether provider-level resampling is enabled.

isSignalConnected

lastError

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

lastErrorFormat

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

lastErrorTitle

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

maxOversampling

Returns maximum oversampling factor for zoomed-out operations.

nativeResolutions

Returns a list of native resolutions if available, i.e. map units per pixel at which the raster source was originally created.

providerCapabilities

Returns flags containing the supported capabilities of the data provider.

pyramidResamplingMethods

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

readFileBasedAttributeTable

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

readNativeAttributeTable

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

readXml

param filterElem:

receivers

reload

Reload data (data could change)

remove

Remove dataset

removeAttributeTable

Remove the attribute table for the specified bandNumber.

sample

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

sender

senderSignalIndex

setAttributeTable

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.

setDpi

Sets the output device resolution.

setEditable

Turns on/off editing mode of the provider.

setError

Sets error message

setInput

It makes no sense to set input on provider */

setMaxOversampling

Sets maximum oversampling factor for zoomed-out operations.

setNoDataValue

Set no data value on created dataset

setUseSourceNoDataValue

Sets the source nodata value usage

setUserNoDataValue

param bandNo:

setZoomedInResamplingMethod

Set resampling method to apply for zoomed-in operations.

setZoomedOutResamplingMethod

Set resampling method to apply for zoomed-out operations.

sourceDataType

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

sourceHasNoDataValue

Returns True if source band has no data value

sourceNoDataValue

Value representing no data value.

stepHeight

Step height for raster iterations.

stepWidth

Step width for raster iterations.

subLayers

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

supportsLegendGraphic

Returns whether the provider supplies a legend graphic

temporalCapabilities

rtype:

QgsRasterDataProviderTemporalCapabilities

timerEvent

timestamp

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

transformCoordinates

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

useSourceNoDataValue

Returns the source nodata value usage

userNoDataValues

Returns a list of user no data value ranges.

userNoDataValuesContains

Returns True if user no data contains value

validateCreationOptions

Validates creation options for a specific dataset and destination format.

validatePyramidsConfigOptions

Validates pyramid creation options for a specific dataset and destination format

write

Writes into the provider datasource

writeBlock

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

writeFileBasedAttributeTable

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

writeNativeAttributeTable

rtype:

Tuple[bool, str]

writeXml

param doc:

zoomedInResamplingMethod

Returns resampling method for zoomed-in operations.

zoomedOutResamplingMethod

Returns resampling method for zoomed-out operations.

Signals

statusChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

Attributes

DpiDependentData

NativeRasterAttributeTable

NoProviderCapabilities

ProviderHintBenefitsFromResampling

ProviderHintCanPerformProviderResampling

ReadLayerMetadata

ReloadData

TransformImageToLayer

TransformLayerToImage

WriteLayerMetadata

DpiDependentData = 64
NativeRasterAttributeTable = 128
NoProviderCapabilities = 0
class ProviderCapabilities
class ProviderCapabilities(Union[QgsRasterDataProvider.ProviderCapabilities, QgsRasterDataProvider.ProviderCapability])
class ProviderCapabilities(QgsRasterDataProvider.ProviderCapabilities)

Bases: sip.wrapper

class ProviderCapability

Bases: int

ProviderHintBenefitsFromResampling = 8
ProviderHintCanPerformProviderResampling = 16
ReadLayerMetadata = 2
ReloadData = 32
class ResamplingMethod(value)

Bases: enum.IntEnum

Resampling method for provider-level resampling.

New in version 3.16.

  • 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

Average = 5
Bilinear = 1
Cubic = 2
CubicSpline = 3
Gauss = 7
Lanczos = 4
Mode = 6
Nearest = 0
TransformImageToLayer = 0
TransformLayerToImage = 1
class TransformType

Bases: int

class VirtualRasterInputLayers
class VirtualRasterInputLayers(QgsRasterDataProvider.VirtualRasterInputLayers)

Bases: sip.wrapper

name
provider
uri
class VirtualRasterParameters
class VirtualRasterParameters(QgsRasterDataProvider.VirtualRasterParameters)

Bases: sip.wrapper

crs
extent
formula
height
rInputLayers
width
WriteLayerMetadata = 4
appendError(self, message: QgsErrorMessage)

Add error message

attributeTable(self, bandNumber: int) QgsRasterAttributeTable

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

New in version 3.30.

Parameters:

bandNumber (int) –

Return type:

QgsRasterAttributeTable

bandDescription(self, bandNumber: int) str
Parameters:

bandNumber (int) –

Return type:

str

bandOffset(self, bandNo: int) float

Read band offset for raster value

Parameters:

bandNo (int) –

Return type:

float

bandScale(self, bandNo: int) float

Read band scale for raster value

Parameters:

bandNo (int) –

Return type:

float

block(self, bandNo: int, boundingBox: QgsRectangle, width: int, height: int, feedback: QgsRasterBlockFeedback = None) QgsRasterBlock

Read block of data using given extent and size.

Parameters:
Return type:

QgsRasterBlock

buildPyramidList(self, overviewList: Iterable[int] = []) List[QgsRasterPyramid]

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( ``True` )` for every layer you want to create pyramids for, and then pass the modified list to buildPyramids().

Parameters:

overviewList (Iterable[int] = []) – used to construct the pyramid list (optional), when empty the list is defined by the provider.

See also

buildPyramids()

See also

hasPyramids()

Return type:

List[QgsRasterPyramid]

buildPyramids(self, pyramidList: Iterable[QgsRasterPyramid], resamplingMethod: str = '', format: Qgis.RasterPyramidFormat = Qgis.RasterPyramidFormat.GeoTiff, configOptions: Iterable[str] = [], feedback: QgsRasterBlockFeedback = None) str

Creates pyramid overviews.

Parameters:
  • pyramidList (Iterable[QgsRasterPyramid]) – 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 (str = '') – 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 (Qgis.RasterPyramidFormat = Qgis.RasterPyramidFormat.GeoTiff) – raster pyramid format.

  • configOptions (Iterable[str] = []) – optional configuration options which are passed to the specific data provider for use during pyramid creation.

  • feedback (QgsRasterBlockFeedback = None) – optional feedback argument for progress reports and cancellation support.

See also

hasPyramids()

Return type:

str

childEvent(self, QChildEvent)
clone(self) QgsRasterDataProvider
Return type:

QgsRasterDataProvider

colorInterpretation(self, bandNo: int) Qgis.RasterColorInterpretation

Returns data type for the band specified by number

Parameters:

bandNo (int) –

Return type:

Qgis.RasterColorInterpretation

colorInterpretationName(self, bandNo: int) str
Parameters:

bandNo (int) –

Return type:

str

colorName(self, colorInterpretation: Qgis.RasterColorInterpretation) str

Returns a string color name representation of a color interpretation.

Parameters:

colorInterpretation (Qgis.RasterColorInterpretation) –

Return type:

str

colorTable(self, bandNo: int) List[QgsColorRampShader.ColorRampItem]
Parameters:

bandNo (int) –

Return type:

List[QgsColorRampShader.ColorRampItem]

connectNotify(self, QMetaMethod)
copyBaseSettings(self, other: QgsRasterDataProvider)

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

Parameters:

other (QgsRasterDataProvider) –

create(providerKey: str, uri: str, format: str, nBands: int, type: Qgis.DataType, width: int, height: int, crs: QgsCoordinateReferenceSystem, createOptions: Iterable[str] = []) Tuple[QgsRasterDataProvider, float]

Creates a new dataset with mDataSourceURI

Parameters:
  • providerKey (str) –

  • uri (str) –

  • format (str) –

  • nBands (int) –

  • type (Qgis.DataType) –

  • width (int) –

  • height (int) –

  • crs (QgsCoordinateReferenceSystem) –

  • createOptions (Iterable[str] = []) –

Return type:

Tuple[QgsRasterDataProvider, float]

customEvent(self, QEvent)
dataTimestamp(self) QDateTime

Current time stamp of data source

Return type:

QDateTime

dataType(self, bandNo: int) Qgis.DataType

Returns data type for the band specified by number

Parameters:

bandNo (int) –

Return type:

Qgis.DataType

decodeVirtualRasterProviderUri(uri: str) Tuple[QgsRasterDataProvider.VirtualRasterParameters, bool]

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

Note

used by Virtual Raster Provider only

Note

since QGIS 3.22

Parameters:

uri (str) –

Return type:

Tuple[QgsRasterDataProvider.VirtualRasterParameters, bool]

disconnectNotify(self, QMetaMethod)
dpi(self) int

Returns the dpi of the output device.

Return type:

int

elevationProperties(self) QgsRasterDataProviderElevationProperties
Return type:

QgsRasterDataProviderElevationProperties

enableProviderResampling(self, enable: bool) bool

Enable or disable provider-level resampling.

Return type:

bool

Returns:

True if success

New in version 3.16.

Parameters:

enable (bool) –

encodeVirtualRasterProviderUri(parts: QgsRasterDataProvider.VirtualRasterParameters) str

Encodes the URI starting from the struct .

Note

used by Virtual Raster Provider only

Note

since QGIS 3.22

Parameters:

parts (QgsRasterDataProvider.VirtualRasterParameters) –

Return type:

str

extent(self) QgsRectangle
Return type:

QgsRectangle

fields(self) QgsFields

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

New in version 3.14.

Return type:

QgsFields

getLegendGraphicFetcher(self, mapSettings: QgsMapSettings) QgsImageFetcher

Returns a new image downloader for the raster legend.

Parameters:

mapSettings (QgsMapSettings) – map settings for legend providers supporting contextual legends.

Return type:

QgsImageFetcher

Returns:

a download handler or None if the provider does not support legend at all. Ownership of the returned object is transferred to caller.

hasPyramids(self) bool

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

buildPyramids()

Return type:

bool

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

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:
  • point (QgsPointXY) – coordinates in data source CRS

  • format (Qgis.RasterIdentifyFormat) – result format

  • boundingBox (QgsRectangle = QgsRectangle()) – context bounding box

  • width (int = 0) – context width

  • height (int = 0) – context height

  • dpi (int = 96) – context dpi

Return type:

QgsRasterIdentifyResult

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()

identifyFormatFromName(formatName: str) Qgis.RasterIdentifyFormat

Converts a string formatName to a raster identify format.

Parameters:

formatName (str) –

Return type:

Qgis.RasterIdentifyFormat

identifyFormatLabel(format: Qgis.RasterIdentifyFormat) str

Converts a raster identify format to a translated string label.

Parameters:

format (Qgis.RasterIdentifyFormat) –

Return type:

str

identifyFormatName(format: Qgis.RasterIdentifyFormat) str

Converts a raster identify format to a string name.

Parameters:

format (Qgis.RasterIdentifyFormat) –

Return type:

str

identifyFormatToCapability(format: Qgis.RasterIdentifyFormat) QgsRasterInterface.Capability

Converts a raster identify format to a capability.

Parameters:

format (Qgis.RasterIdentifyFormat) –

Return type:

QgsRasterInterface.Capability

ignoreExtents(self) bool

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.

New in version 3.10.0.

Return type:

bool

initHistogram(self, histogram: QgsRasterHistogram, bandNo: int, binCount: int, minimum: object = Py_None, maximum: object = Py_None, boundingBox: QgsRectangle = QgsRectangle(), sampleSize: int = 0, includeOutOfRange: bool = False)

Fill in histogram defaults if not specified

Note

the parameters are the same as in histogram()

initStatistics(self, statistics: QgsRasterBandStats, bandNo: int, stats: int, boundingBox: QgsRectangle = QgsRectangle(), binCount: int = 0)

Fill in statistics defaults if not specified

Deprecated since version Use: Qgis.RasterBandStatistic instead of int for stats argument

initStatistics(self, statistics: QgsRasterBandStats, bandNo: int, stats: Union[Qgis.RasterBandStatistics, Qgis.RasterBandStatistic] = Qgis.RasterBandStatistic.All, boundingBox: QgsRectangle = QgsRectangle(), binCount: int = 0) Fill in statistics defaults if not specified

isEditable(self) bool

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()

Return type:

bool

isProviderResamplingEnabled(self) bool

Returns whether provider-level resampling is enabled.

Note

Resampling is effective only if zoomedInResamplingMethod() and/or zoomedOutResamplingMethod() return non-nearest resampling.

New in version 3.16.

Return type:

bool

isSignalConnected(self, QMetaMethod) bool
lastError(self) str

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.

Return type:

str

lastErrorFormat(self) str

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

Return type:

str

lastErrorTitle(self) str

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.

Return type:

str

maxOversampling(self) float

Returns maximum oversampling factor for zoomed-out operations.

New in version 3.16.

Return type:

float

nativeResolutions(self) List[float]

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().

New in version 3.8.0.

Return type:

List[float]

providerCapabilities(self) QgsRasterDataProvider.ProviderCapabilities

Returns flags containing the supported capabilities of the data provider.

Return type:

QgsRasterDataProvider.ProviderCapabilities

pyramidResamplingMethods(providerKey: str) List[Tuple[str, str]]

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

Parameters:

providerKey (str) –

Return type:

List[Tuple[str, str]]

readFileBasedAttributeTable(self, bandNumber: int, path: str) Tuple[bool, str]

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

Return type:

Tuple[bool, str]

Returns:

True on success

New in version 3.30.

Parameters:
  • bandNumber (int) –

  • path (str) –

readNativeAttributeTable(self) Tuple[bool, str]

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.

Return type:

Tuple[bool, str]

Returns:

True on success

New in version 3.30.

readXml(self, filterElem: QDomElement)
Parameters:

filterElem (QDomElement) –

receivers(self, PYQT_SIGNAL) int
reload(self) bool

Reload data (data could change)

Return type:

bool

remove(self) bool

Remove dataset

Return type:

bool

removeAttributeTable(self, bandNumber: int)

Remove the attribute table for the specified bandNumber. If the attribute table does not exist this method does nothing.

New in version 3.30.

Parameters:

bandNumber (int) –

sample(self, point: QgsPointXY, band: int, boundingBox: QgsRectangle = QgsRectangle(), width: int = 0, height: int = 0, dpi: int = 96) Tuple[float, bool]

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()

New in version 3.4.

Parameters:
  • point (QgsPointXY) –

  • band (int) –

  • boundingBox (QgsRectangle = QgsRectangle()) –

  • width (int = 0) –

  • height (int = 0) –

  • dpi (int = 96) –

Return type:

Tuple[float, bool]

sender(self) QObject
senderSignalIndex(self) int
setAttributeTable(self, bandNumber: int, attributeTable: QgsRasterAttributeTable)

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.

New in version 3.30.

Parameters:
setDpi(self, dpi: int)

Sets the output device resolution.

Parameters:

dpi (int) –

setEditable(self, enabled: bool) bool

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

Return type:

bool

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()

Parameters:

enabled (bool) –

setError(self, error: QgsError)

Sets error message

setInput(self, input: QgsRasterInterface) bool

It makes no sense to set input on provider */

Parameters:

input (QgsRasterInterface) –

Return type:

bool

setMaxOversampling(self, factor: float) bool

Sets maximum oversampling factor for zoomed-out operations.

Return type:

bool

Returns:

True if success

New in version 3.16.

Parameters:

factor (float) –

setNoDataValue(self, bandNo: int, noDataValue: float) bool

Set no data value on created dataset

Parameters:
  • bandNo (int) – band number

  • noDataValue (float) – no data value

Return type:

bool

setUseSourceNoDataValue(self, bandNo: int, use: bool)

Sets the source nodata value usage

Parameters:
  • bandNo (int) –

  • use (bool) –

setUserNoDataValue(self, bandNo: int, noData: Iterable[QgsRasterRange])
Parameters:
setZoomedInResamplingMethod(self, method: QgsRasterDataProvider.ResamplingMethod) bool

Set resampling method to apply for zoomed-in operations.

Return type:

bool

Returns:

True if success

New in version 3.16.

Parameters:

method (QgsRasterDataProvider.ResamplingMethod) –

setZoomedOutResamplingMethod(self, method: QgsRasterDataProvider.ResamplingMethod) bool

Set resampling method to apply for zoomed-out operations.

Return type:

bool

Returns:

True if success

New in version 3.16.

Parameters:

method (QgsRasterDataProvider.ResamplingMethod) –

sourceDataType(self, bandNo: int) Qgis.DataType

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

Parameters:

bandNo (int) –

Return type:

Qgis.DataType

sourceHasNoDataValue(self, bandNo: int) bool

Returns True if source band has no data value

Parameters:

bandNo (int) –

Return type:

bool

sourceNoDataValue(self, bandNo: int) float

Value representing no data value.

Parameters:

bandNo (int) –

Return type:

float

statusChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

stepHeight(self) int

Step height for raster iterations.

See also

stepWidth()

Return type:

int

stepWidth(self) int

Step width for raster iterations.

See also

stepHeight()

Return type:

int

subLayers(self) List[str]

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

Return type:

List[str]

supportsLegendGraphic(self) bool

Returns whether the provider supplies a legend graphic

Return type:

bool

temporalCapabilities(self) QgsRasterDataProviderTemporalCapabilities
Return type:

QgsRasterDataProviderTemporalCapabilities

timerEvent(self, QTimerEvent)
timestamp(self) QDateTime

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

Return type:

QDateTime

transformCoordinates(self, point: QgsPoint, type: QgsRasterDataProvider.TransformType) QgsPoint

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.

New in version 3.14.

Parameters:
Return type:

QgsPoint

useSourceNoDataValue(self, bandNo: int) bool

Returns the source nodata value usage

Parameters:

bandNo (int) –

Return type:

bool

userNoDataValues(self, bandNo: int) List[QgsRasterRange]

Returns a list of user no data value ranges.

Parameters:

bandNo (int) –

Return type:

List[QgsRasterRange]

userNoDataValuesContains(self, bandNo: int, value: float) bool

Returns True if user no data contains value

Parameters:
  • bandNo (int) –

  • value (float) –

Return type:

bool

validateCreationOptions(self, createOptions: Iterable[str], format: str) str

Validates creation options for a specific dataset and destination format.

Note

used by GDAL provider only

Note

see also validateCreationOptionsFormat() in gdal provider for validating options based on format only

Parameters:
  • createOptions (Iterable[str]) –

  • format (str) –

Return type:

str

validatePyramidsConfigOptions(self, pyramidsFormat: Qgis.RasterPyramidFormat, configOptions: Iterable[str], fileFormat: str) str

Validates pyramid creation options for a specific dataset and destination format

Note

used by GDAL provider only

Parameters:
Return type:

str

write(self, data: sip.voidptr, band: int, width: int, height: int, xOffset: int, yOffset: int) bool

Writes into the provider datasource

Parameters:
  • data (sip.voidptr) –

  • band (int) –

  • width (int) –

  • height (int) –

  • xOffset (int) –

  • yOffset (int) –

Return type:

bool

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

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()

Return type:

bool

Returns:

True on success

Parameters:
  • block (QgsRasterBlock) –

  • band (int) –

  • xOffset (int = 0) –

  • yOffset (int = 0) –

writeFileBasedAttributeTable(self, bandNumber: int, path: str) Tuple[bool, str]

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

Return type:

Tuple[bool, str]

Returns:

True on success

Note

No checks for Raster Attribute Table validity are performed when saving, it is client code responsibility to handle validation.

New in version 3.30.

Parameters:
  • bandNumber (int) –

  • path (str) –

writeNativeAttributeTable(self) Tuple[bool, str]
Return type:

Tuple[bool, str]

writeXml(self, doc: QDomDocument, parentElem: QDomElement)
Parameters:
  • doc (QDomDocument) –

  • parentElem (QDomElement) –

zoomedInResamplingMethod(self) QgsRasterDataProvider.ResamplingMethod

Returns resampling method for zoomed-in operations.

New in version 3.16.

Return type:

QgsRasterDataProvider.ResamplingMethod

zoomedOutResamplingMethod(self) QgsRasterDataProvider.ResamplingMethod

Returns resampling method for zoomed-out operations.

New in version 3.16.

Return type:

QgsRasterDataProvider.ResamplingMethod