Class: QgsMapLayerFactory¶
- class qgis.core.QgsMapLayerFactory¶
Bases:
sip.wrapper
Contains utility functions for creating map layers.
New in version 3.18.1:
Methods
Creates a map layer, given a
uri
,name
, layertype
andprovider
name.Returns the map layer type corresponding a
string
value.Converts a map layer
type
to a string value.- class LayerOptions(transformContext: QgsCoordinateTransformContext)¶
Bases:
sip.wrapper
Constructor for LayerOptions with
transformContext
.QgsMapLayerFactory.LayerOptions(QgsMapLayerFactory.LayerOptions)
- loadAllStoredStyles¶
- loadDefaultStyle¶
- transformContext¶
- createLayer(uri: str, name: str, type: Qgis.LayerType, options: QgsMapLayerFactory.LayerOptions, provider: str = '') QgsMapLayer ¶
Creates a map layer, given a
uri
,name
, layertype
andprovider
name.Caller takes ownership of the returned layer.
New in version 3.22.
- Parameters:
uri (str) –
name (str) –
type (Qgis.LayerType) –
options (QgsMapLayerFactory.LayerOptions) –
provider (str = '') –
- Return type:
- typeFromString(string: str) Tuple[Qgis.LayerType, bool] ¶
Returns the map layer type corresponding a
string
value.- Parameters:
string (str) – string to convert to map layer type
- Return type:
Tuple[Qgis.LayerType, bool]
- Returns:
converted map layer type
ok: will be set to
True
ifstring
was successfully converted to a map layer type
See also
- typeToString(type: Qgis.LayerType) str ¶
Converts a map layer
type
to a string value.See also
- Parameters:
type (Qgis.LayerType) –
- Return type:
str