Class: QgsProviderUtils

class qgis.core.QgsProviderUtils

Bases: sip.wrapper

Contains utility functions for working with data providers.

New in version 3.22:

Enums

SublayerCompletenessFlag

Bases: enum.IntEnum

Methods

sublayerDetailsAreIncomplete

Returns True if the sublayer details are incomplete, and require a more in-depth scan.

suggestLayerNameFromFilePath

Suggests a suitable layer name given only a file path.

class SublayerCompletenessFlag(value)

Bases: enum.IntEnum

Flags which control how QgsProviderUtils.sublayerDetailsAreIncomplete() tests for completeness.

  • IgnoreUnknownFeatureCount: Indicates that an unknown feature count should not be considered as incomplete

  • IgnoreUnknownGeometryType: Indicates that an unknown geometry type should not be considered as incomplete

IgnoreUnknownFeatureCount = 1
IgnoreUnknownGeometryType = 2
class SublayerCompletenessFlags
class SublayerCompletenessFlags(Union[QgsProviderUtils.SublayerCompletenessFlags, QgsProviderUtils.SublayerCompletenessFlag]) None
class SublayerCompletenessFlags(QgsProviderUtils.SublayerCompletenessFlags) None

Bases: sip.wrapper

sublayerDetailsAreIncomplete(details: Iterable[QgsProviderSublayerDetails], flags: Union[QgsProviderUtils.SublayerCompletenessFlags, QgsProviderUtils.SublayerCompletenessFlag] = QgsProviderUtils.SublayerCompletenessFlags()) bool

Returns True if the sublayer details are incomplete, and require a more in-depth scan.

For instance, if the details contain any vector sublayers with unknown geometry types then a query with the Qgis.SublayerQueryFlag.ResolveGeometryType flag is required.

The flags argument can be used to control the level of completeness required during the test.

Parameters
Return type

bool

suggestLayerNameFromFilePath(path: str) str

Suggests a suitable layer name given only a file path.

Usually this corresponds to the base file name of path (e.g. “rivers” for a path of “c:/my data/water/rivers.shp”). However some data formats which use fixed file paths (such as aigrid files) will instead return the parent directory name (e.g. “rivers” for a path of “c:/my data/water/rivers/hdr.adf”).

Parameters

path (str) –

Return type

str