Class: QgsProviderSublayerDetails

class qgis.core.QgsProviderSublayerDetails

Bases: sip.wrapper

Contains details about a sub layer available from a dataset.

This class encapsulates the properties of a single sublayer available from a dataset, according to a specific data provider.

Note

It is possible that multiple data providers may be able to utilize the same underlying sub layer in a single dataset, yet will interpret this layer differently. For instance, a layer in a GeoPDF document can be interpreted as either a vector layer by the OGR data provider or a raster layer by the GDAL provider. The providerKey() property can be used to determine the data provider associated with a QgsProviderSubLayerDetails instance.

New in version 3.22:

Methods

description

Returns the layer's description.

driverName

Returns the layer's driver name.

featureCount

Returns the layer's feature count.

flags

Returns the layer's flags, which indicate properties of the layer.

geometryColumnName

Returns the layer's geometry column name, or an empty string if not applicable.

layerNumber

Returns the associated layer number, for providers which order sublayers.

name

Returns the layer's name.

path

Returns the path to the sublayer.

providerKey

Returns the associated data provider key.

setDescription

Sets the layer's description.

setDriverName

Sets the layer's driver name.

setFeatureCount

Sets the layer's feature count.

setFlags

Sets the layer's flags, which indicate properties of the layer.

setGeometryColumnName

Sets the layer's geometry column name.

setLayerNumber

Sets the associated layer number, for providers which order sublayers.

setName

Sets the layer's name.

setPath

Sets the path to the sublayer.

setProviderKey

Sets the associated data provider key.

setSkippedContainerScan

Set to True if the layer is a potential dataset container and an in-depth scan of its contents was skipped.

setType

Sets the layer type.

setUri

Sets the layer's uri.

setWkbType

Set the layer's WKB type.

skippedContainerScan

Returns True if the layer is a potential dataset container and an in-depth scan of its contents was skipped.

toLayer

Creates a new QgsMapLayer object associated with the sublayer.

toMimeUri

Converts the sublayer details to a QgsMimeDataUtils.Uri representing the sublayer.

type

Returns the layer type.

uri

Returns the layer's URI.

wkbType

Returns the layer's WKB type, or QgsWkbTypes.Unknown if the WKB type is not application or unknown.

class LayerOptions(transformContext: QgsCoordinateTransformContext)

Bases: sip.wrapper

Constructor for LayerOptions with transformContext.

QgsProviderSublayerDetails.LayerOptions(QgsProviderSublayerDetails.LayerOptions)

loadAllStoredStyle
loadDefaultStyle
transformContext
description(self) str

Returns the layer’s description.

See also

setDescription()

Return type

str

driverName(self) str

Returns the layer’s driver name.

This is supported only for providers which handle multiple drivers.

See also

setDriverName()

Return type

str

featureCount(self) int

Returns the layer’s feature count.

Will return Qgis.FeatureCountState.UnknownCount or Qgis.FeatureCountState.Uncounted if no feature count is applicable or available.

Return type

int

flags(self) Qgis.SublayerFlags

Returns the layer’s flags, which indicate properties of the layer.

See also

setFlags()

Return type

Qgis.SublayerFlags

geometryColumnName(self) str

Returns the layer’s geometry column name, or an empty string if not applicable.

Return type

str

layerNumber(self) int

Returns the associated layer number, for providers which order sublayers.

See also

setLayerNumber()

Return type

int

name(self) str

Returns the layer’s name.

See also

setName()

Return type

str

path(self) List[str]

Returns the path to the sublayer.

This is an internal path, relative to the dataset itself. It can be used to encapsulate the hierarchy of a dataset which organises layers in schemas or in an internal folder structure.

See also

setPath()

Return type

List[str]

providerKey(self) str

Returns the associated data provider key.

See also

setProviderKey()

Return type

str

setDescription(self, description: str)

Sets the layer’s description.

See also

description()

Parameters

description (str) –

setDriverName(self, driver: str)

Sets the layer’s driver name.

See also

driverName()

Parameters

driver (str) –

setFeatureCount(self, count: int)

Sets the layer’s feature count.

Set to Qgis.FeatureCountState.UnknownCount or Qgis.FeatureCountState.Uncounted if no feature count is applicable or available.

See also

featureCount()

Parameters

count (int) –

setFlags(self, newFlags: Union[Qgis.SublayerFlags, Qgis.SublayerFlag])

Sets the layer’s flags, which indicate properties of the layer.

See also

flags()

Parameters

newFlags (Union[Qgis.SublayerFlags) –

setGeometryColumnName(self, name: str)

Sets the layer’s geometry column name.

Set to an empty string if not applicable.

Parameters

name (str) –

setLayerNumber(self, number: int)

Sets the associated layer number, for providers which order sublayers.

See also

layerNumber()

Parameters

number (int) –

setName(self, name: str)

Sets the layer’s name.

See also

name()

Parameters

name (str) –

setPath(self, path: Iterable[str])

Sets the path to the sublayer.

This is an internal path, relative to the dataset itself. It can be used to encapsulate the hierarchy of a dataset which organises layers in schemas or in an internal folder structure.

See also

path()

Parameters

path (Iterable[str]) –

setProviderKey(self, key: str)

Sets the associated data provider key.

See also

providerKey()

Parameters

key (str) –

setSkippedContainerScan(self, skipped: bool)

Set to True if the layer is a potential dataset container and an in-depth scan of its contents was skipped.

Parameters

skipped (bool) –

setType(self, type: QgsMapLayerType)

Sets the layer type.

See also

type()

Parameters

type (QgsMapLayerType) –

setUri(self, uri: str)

Sets the layer’s uri.

See also

uri()

Parameters

uri (str) –

setWkbType(self, type: QgsWkbTypes.Type)

Set the layer’s WKB type.

Set to QgsWkbTypes.Unknown if the WKB type is not application or unknown.

See also

wkbType()

Parameters

type (QgsWkbTypes.Type) –

skippedContainerScan(self) bool

Returns True if the layer is a potential dataset container and an in-depth scan of its contents was skipped.

Return type

bool

toLayer(self, options: QgsProviderSublayerDetails.LayerOptions) QgsMapLayer

Creates a new QgsMapLayer object associated with the sublayer.

Caller takes ownership of the returned layer.

Parameters

options (QgsProviderSublayerDetails.LayerOptions) –

Return type

QgsMapLayer

toMimeUri(self) QgsMimeDataUtils.Uri

Converts the sublayer details to a QgsMimeDataUtils.Uri representing the sublayer.

New in version 3.28.

Return type

QgsMimeDataUtils.Uri

type(self) QgsMapLayerType

Returns the layer type.

See also

setType()

Return type

QgsMapLayerType

uri(self) str

Returns the layer’s URI.

See also

setUri()

Return type

str

wkbType(self) QgsWkbTypes.Type

Returns the layer’s WKB type, or QgsWkbTypes.Unknown if the WKB type is not application or unknown.

See also

setWkbType()

Return type

QgsWkbTypes.Type