Class: QgsMapLayerFactory¶
Contains utility functions for creating map layers.
Added in version 3.18.1.
List of all members, including inherited members
Classes
Setting options for loading layers. |
Static Methods
Creates a map layer, given a uri, name, layer type and provider name. |
|
Returns the map layer type corresponding a string value. |
|
Converts a map layer type to a string value. |
- class qgis.core.QgsMapLayerFactory[source]¶
Bases:
object- class LayerOptions¶
Bases:
objectSetting options for loading layers.
Added in version 3.22.
- loadAllStoredStyles: bool¶
- loadDefaultStyle: bool¶
- transformContext: QgsCoordinateTransformContext¶
- static createLayer(uri: str | None, name: str | None, type: Qgis.LayerType, options: QgsMapLayerFactory.LayerOptions, provider: str | None = '') QgsMapLayer | None[source]¶
Creates a map layer, given a
uri,name, layertypeandprovidername.Caller takes ownership of the returned layer.
Added in version 3.22.
- Parameters:
uri (Optional[str])
name (Optional[str])
type (Qgis.LayerType)
options (QgsMapLayerFactory.LayerOptions)
provider (Optional[str] = '')
- Return type:
Optional[QgsMapLayer]
- static typeFromString(string: str | None)[source]¶
Returns the map layer type corresponding a
stringvalue.- Parameters:
string (Optional[str]) – string to convert to map layer type
- Return type:
(Qgis.LayerType, bool)
- Returns:
converted map layer type
ok:
Trueifstringwas successfully converted to a map layer type
See also
- static typeToString(type: Qgis.LayerType) str[source]¶
Converts a map layer
typeto a string value.See also
- Parameters:
type (Qgis.LayerType)
- Return type:
str