Class: QgsMeshLayer

class qgis.core.QgsMeshLayer

Bases: QgsMapLayer

Represents a mesh layer supporting display of data on structured or unstructured meshes

The QgsMeshLayer is instantiated by specifying the name of a data provider, such as mdal, and url defining the specific data set to connect to. The vector layer constructor in turn instantiates a QgsMeshDataProvider subclass corresponding to the provider type, and passes it the url. The data provider connects to the data source.

The QgsMeshLayer provides a common interface to the different data types. It does not yet support editing transactions.

The main data providers supported by QGIS are listed below.

The memory data provider is used to construct in memory data, for example scratch data. There is no inherent persistent storage of the data. The data source uri is constructed. Data can be populated by setMesh(const QString &vertices, const QString &faces), where vertices and faces is comma separated coordinates and connections for mesh. E.g. to create mesh with one quad and one triangle

uri = "1.0, 2.0 \n" \
    "2.0, 2.0 \n" \
    "3.0, 2.0 \n" \
    "2.0, 3.0 \n" \
    "1.0, 3.0 \n" \
    "---" \
    "0, 1, 3, 4 \n" \
    "1, 2, 3 \n"

scratchLayer = QgsMeshLayer(uri, "My Scratch layer", "mesh_memory")

Accesses data using the MDAL drivers (https://github.com/lutraconsulting/MDAL). The url is the MDAL connection string. QGIS must be built with MDAL support to allow this provider.

uri = "test/land.2dm"
scratchLayer = QgsMeshLayer(uri, "My Scratch Layer",  "mdal")

Note

The API is considered EXPERIMENTAL and can be changed without a notice

New in version 3.2.

QgsMeshLayer(path: str = ‘’, baseName: str = ‘’, providerLib: str = ‘’, options: QgsMeshLayer.LayerOptions = QgsMeshLayer.LayerOptions()) Constructor - creates a mesh layer

The QgsMeshLayer is constructed by instantiating a data provider. The provider interprets the supplied path (url) of the data source to connect to and access the data.

Parameters
class LayerOptions(transformContext: QgsCoordinateTransformContext = QgsCoordinateTransformContext())

Bases: sip.wrapper

Constructor for LayerOptions with optional transformContext.

Note

transformContext argument was added in QGIS 3.8

QgsMeshLayer.LayerOptions(QgsMeshLayer.LayerOptions)

skipCrsValidation
transformContext
activeScalarDatasetAtTime(self, timeRange: QgsDateTimeRange) QgsMeshDatasetIndex

Returns dataset index from active scalar group depending on the time range. If the temporal properties is not active, return the static dataset

Parameters

timeRange (QgsDateTimeRange) – the time range

Return type

QgsMeshDatasetIndex

Returns

dataset index

Note

the returned dataset index depends on the matching method, see setTemporalMatchingMethod()

New in version 3.14.

activeScalarDatasetGroupChanged

Emitted when active scalar group dataset is changed

New in version 3.14: [signal]

Parameters

index (int) –

activeVectorDatasetAtTime(self, timeRange: QgsDateTimeRange) QgsMeshDatasetIndex

Returns dataset index from active vector group depending on the time range If the temporal properties is not active, return the static dataset

Parameters

timeRange (QgsDateTimeRange) – the time range

Return type

QgsMeshDatasetIndex

Returns

dataset index

Note

the returned dataset index depends on the matching method, see setTemporalMatchingMethod()

New in version 3.14.

activeVectorDatasetGroupChanged

Emitted when active vector group dataset is changed

New in version 3.14: [signal]

Parameters

index (int) –

addDatasets(self, path: str, defaultReferenceTime: Union[QDateTime, datetime.datetime] = QDateTime()) bool

Adds datasets to the mesh from file with path. Use the the time defaultReferenceTime as reference time is not provided in the file

Parameters
  • path (str) – the path to the atasets file

  • defaultReferenceTime (Union[QDateTime) – reference time used if not provided in the file

Returns

whether the dataset is added

New in version 3.14.

addDatasets(self, datasetGroup: QgsMeshDatasetGroup) -> bool Adds extra datasets to the mesh. Take ownership.

Parameters

datasetGroup – the extra dataset group

Return type

bool

Returns

whether the dataset is effectively added

New in version 3.16.

appendError(self, error: QgsErrorMessage)

Add error message

areFacesActive(self, index: QgsMeshDatasetIndex, faceIndex: int, count: int) QgsMeshDataBlock

Returns whether the faces are active for particular dataset

Parameters
  • index (QgsMeshDatasetIndex) – index of the dataset

  • faceIndex (int) – index of the face

  • count (int) – number of values to return

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes are different from the data provider indexes.

New in version 3.16.

Return type

QgsMeshDataBlock

childEvent(self, QChildEvent)
clone(self) QgsMeshLayer
Return type

QgsMeshLayer

commitFrameEditing(self, transform: QgsCoordinateTransform, continueEditing: bool = True) bool

Commits edition of the mesh frame, Rebuilds the triangular mesh and its spatial index with transform, Continue editing with the same mesh editor if continueEditing is True

Return type

bool

Returns

True if the commit succeeds

New in version 3.22.

Parameters
connectNotify(self, QMetaMethod)
contains(self, type: QgsMesh.ElementType) bool

Returns whether the mesh contains at mesh elements of given type

New in version 3.22.

Parameters

type (QgsMesh.ElementType) –

Return type

bool

createMapRenderer(self, rendererContext: QgsRenderContext) QgsMapLayerRenderer
Parameters

rendererContext (QgsRenderContext) –

Return type

QgsMapLayerRenderer

customEvent(self, QEvent)
dataProvider(self) QgsMeshDataProvider
Return type

QgsMeshDataProvider

dataset1dValue(self, index: QgsMeshDatasetIndex, point: QgsPointXY, searchRadius: float) QgsMeshDatasetValue

Returns the value of 1D mesh dataset defined on edge that are in the search area defined by point ans searchRadius

Note

It uses previously cached and indexed triangular mesh and so if the layer has not been rendered previously (e.g. when used in a script) it returns NaN value

Parameters
  • index (QgsMeshDatasetIndex) – dataset index specifying group and dataset to extract value from

  • point (QgsPointXY) – the center point of the search area

  • searchRadius (float) – the radius of the searc area in map unit

Return type

QgsMeshDatasetValue

Returns

interpolated value at the projected point. Returns NaN values for values outside the mesh layer and in case triangular mesh was not previously used for rendering

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes are different from the data provider indexes.

New in version 3.14.

dataset3dValue(self, index: QgsMeshDatasetIndex, point: QgsPointXY) QgsMesh3dDataBlock

Returns the 3d values of stacked 3d mesh defined by the given point

Note

It uses previously cached and indexed triangular mesh and so if the layer has not been rendered previously (e.g. when used in a script) it returns NaN value

Parameters
  • index (QgsMeshDatasetIndex) – dataset index specifying group and dataset to extract value from

  • point (QgsPointXY) – point to query in map coordinates

Return type

QgsMesh3dDataBlock

Returns

all 3d stacked values that belong to face defined by given point. Returns invalid block for point outside the mesh layer or in case triangular mesh was not previously used for rendering or for datasets that do not have type DataOnVolumes

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes are different from the data provider indexes.

New in version 3.12.

dataset3dValues(self, index: QgsMeshDatasetIndex, faceIndex: int, count: int) QgsMesh3dDataBlock

Returns N vector/scalar values from the face index from the dataset for 3d stacked meshes

See QgsMeshDatasetMetadata.isVector() to check if the returned value is vector or scalar

returns invalid block for DataOnFaces and DataOnVertices.

Parameters
  • index (QgsMeshDatasetIndex) – index of the dataset

  • faceIndex (int) – index of the face

  • count (int) – number of values to return

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes can be different from the data provider indexes.

New in version 3.16.

Return type

QgsMesh3dDataBlock

datasetCount(self, index: QgsMeshDatasetIndex) int

Returns the dataset count in the dataset groups

Parameters

index (QgsMeshDatasetIndex) – index of the dataset in the group

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes can be different from the data provider indexes.

New in version 3.16.

Return type

int

datasetGroupCount(self) int

Returns the dataset groups count handle by the layer

New in version 3.16.

Return type

int

datasetGroupMetadata(self, index: QgsMeshDatasetIndex) QgsMeshDatasetGroupMetadata

Returns the dataset groups metadata

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes can be different from the data provider indexes.

New in version 3.16.

Parameters

index (QgsMeshDatasetIndex) –

Return type

QgsMeshDatasetGroupMetadata

datasetGroupTreeRootItem(self) QgsMeshDatasetGroupTreeItem

Returns the root items of the dataset group tree item

Return type

QgsMeshDatasetGroupTreeItem

Returns

the root item

New in version 3.14.

datasetGroupsIndexes(self) List[int]

Returns the list of indexes of dataset groups handled by the layer

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes can be different from the data provider indexes.

New in version 3.16.

Return type

List[int]

datasetIndexAtRelativeTime(self, relativeTime: QgsInterval, datasetGroupIndex: int) QgsMeshDatasetIndex

Returns dataset index from datasets group depending on the relative time from the layer reference time. Dataset index is valid even the temporal properties is inactive. This method is used for calculation on mesh layer.

Parameters
  • relativeTime (QgsInterval) – the relative from the mesh layer reference time

  • datasetGroupIndex (int) – the index of the dataset group

Return type

QgsMeshDatasetIndex

Returns

dataset index

Note

the returned dataset index depends on the matching method, see setTemporalMatchingMethod()

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes are different from the data provider indexes.

New in version 3.16.

datasetIndexAtTime(self, timeRange: QgsDateTimeRange, datasetGroupIndex: int) QgsMeshDatasetIndex

Returns dataset index from datasets group depending on the time range. If the temporal properties is not active, returns invalid dataset index. This method is used for rendering mesh layer.

Parameters
  • timeRange (QgsDateTimeRange) – the time range

  • datasetGroupIndex (int) – the index of the dataset group

Return type

QgsMeshDatasetIndex

Returns

dataset index

Note

the returned dataset index depends on the matching method, see setTemporalMatchingMethod()

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes are different from the data provider indexes.

New in version 3.14.

datasetMetadata(self, index: QgsMeshDatasetIndex) QgsMeshDatasetMetadata

Returns the dataset metadata

Parameters

index (QgsMeshDatasetIndex) – index of the dataset

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes can be different from the data provider indexes.

New in version 3.16.

Return type

QgsMeshDatasetMetadata

datasetRelativeTime(self, index: QgsMeshDatasetIndex) QgsInterval

Returns the relative time of the dataset from the reference time of its group

New in version 3.16.

Parameters

index (QgsMeshDatasetIndex) –

Return type

QgsInterval

datasetRelativeTimeInMilliseconds(self, index: QgsMeshDatasetIndex) int

Returns the relative time (in milliseconds) of the dataset from the reference time of its group

New in version 3.16.

Parameters

index (QgsMeshDatasetIndex) –

Return type

int

datasetValue(self, index: QgsMeshDatasetIndex, valueIndex: int) QgsMeshDatasetValue

Returns vector/scalar value associated with the index from the dataset To read multiple continuous values, use datasetValues()

See QgsMeshDatasetMetadata.isVector() or QgsMeshDataBlock.type() to check if the returned value is vector or scalar

Returns invalid value for DataOnVolumes

Parameters

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes can be different from the data provider indexes.

New in version 3.16.

datasetValue(self, index: QgsMeshDatasetIndex, point: QgsPointXY, searchRadius: float = 0) -> QgsMeshDatasetValue Interpolates the value on the given point from given dataset. For 3D datasets, it uses dataset3dValue(), n For 1D datasets, it uses dataset1dValue() with searchRadius

Note

It uses previously cached and indexed triangular mesh and so if the layer has not been rendered previously (e.g. when used in a script) it returns NaN value

Parameters
  • index – dataset index specifying group and dataset to extract value from

  • point – point to query in map coordinates

  • searchRadius – the radius of the search area in map unit

Return type

QgsMeshDatasetValue

Returns

interpolated value at the point. Returns NaN values for values outside the mesh layer, nodata values and in case triangular mesh was not previously used for rendering

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes are different from the data provider indexes.

New in version 3.4.

datasetValues(self, index: QgsMeshDatasetIndex, valueIndex: int, count: int) QgsMeshDataBlock

Returns N vector/scalar values from the index from the dataset

See QgsMeshDatasetMetadata.isVector() or QgsMeshDataBlock.type() to check if the returned value is vector or scalar

Returns invalid block for DataOnVolumes. Use QgsMeshLayerUtils.datasetValues() if you need block for any type of data type

Parameters
  • index (QgsMeshDatasetIndex) – index of the dataset

  • valueIndex (int) – index of the value

  • count (int) – number of values to return

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes can be different from the data provider indexes.

New in version 3.16.

Return type

QgsMeshDataBlock

decodedSource(self, source: str, provider: str, context: QgsReadWriteContext) str
Parameters
Return type

str

disconnectNotify(self, QMetaMethod)
enabledDatasetGroupsIndexes(self) List[int]

Returns the list of indexes of enables dataset groups handled by the layer

Note

indexes are used to distinguish all the dataset groups handled by the layer (from dataprovider, extra dataset group,…) In the layer scope, those indexes can be different from the data provider indexes.

New in version 3.16.3.

Return type

List[int]

encodedSource(self, source: str, context: QgsReadWriteContext) str
Parameters
Return type

str

extent(self) QgsRectangle
Return type

QgsRectangle

extraDatasetGroupCount(self) int

Returns the extra dataset groups count handle by the layer

New in version 3.16.

Return type

int

firstValidTimeStep(self) QgsInterval

Returns the first valid time step of the dataset groups, invalid QgInterval if no time step is present

New in version 3.14.

Return type

QgsInterval

formatTime(self, hours: float) str

Returns (date) time in hours formatted to human readable form

Parameters

hours (float) – time in double in hours

Return type

str

Returns

formatted time string

New in version 3.8.

hasDependencyCycle(self, Iterable[QgsMapLayerDependency]) bool

Checks whether a new set of dependencies will introduce a cycle this method is now deprecated and always return False, because circular dependencies are now correctly managed.

Deprecated since version QGIS: 3.10

htmlMetadata(self) str
Return type

str

invalidateWgs84Extent(self)

Invalidates the WGS84 extent. If FlagTrustLayerMetadata is enabled, the extent is not invalidated because we want to trust metadata whatever happens.

New in version 3.20.

isEditable(self) bool
Return type

bool

isFaceActive(self, index: QgsMeshDatasetIndex, faceIndex: int) bool

Returns N vector/scalar values from the face index from the dataset for 3d stacked meshes

See QgsMeshDatasetMetadata.isVector() to check if the returned value is vector or scalar

returns invalid block for DataOnFaces and DataOnVertices.

Parameters
Return type

bool

isModified(self) bool

Returns whether the mesh frame has been modified since the last save

New in version 3.22.

Return type

bool

isSignalConnected(self, QMetaMethod) bool
meshEdgeCount(self) int

Returns the edges count of the mesh frame

New in version 3.22.

Return type

int

meshEditor(self) QgsMeshEditor

Returns a pointer to the mesh editor own by the mesh layer

New in version 3.22.

Return type

QgsMeshEditor

meshFaceCount(self) int

Returns the faces count of the mesh frame

New in version 3.22.

Return type

int

meshVertexCount(self) int

Returns the vertices count of the mesh frame

New in version 3.22.

Return type

int

providerType(self) str

Returns the provider type for this layer

Return type

str

readCommonStyle(self, layerElement: QDomElement, context: QgsReadWriteContext, categories: Union[QgsMapLayer.StyleCategories, QgsMapLayer.StyleCategory] = QgsMapLayer.AllStyleCategories)

Read style data common to all layer types

New in version 3.0.

readCustomProperties(self, layerNode: QDomNode, keyStartsWith: str = '')

Read custom properties from project file.

Parameters
  • layerNode – note to read from

  • keyStartsWith – reads only properties starting with the specified string (or all if the string is empty)

readStyle(self, node: QDomNode, errorMessage: str, context: QgsReadWriteContext, categories: Union[QgsMapLayer.StyleCategories, QgsMapLayer.StyleCategory] = QgsMapLayer.AllStyleCategories) bool
Parameters
Return type

bool

readStyleManager(self, layerNode: QDomNode)

Read style manager’s configuration (if any). To be called by subclasses.

readSymbology(self, node: QDomNode, errorMessage: str, context: QgsReadWriteContext, categories: Union[QgsMapLayer.StyleCategories, QgsMapLayer.StyleCategory] = QgsMapLayer.AllStyleCategories) bool
Parameters
Return type

bool

readXml(self, layer_node: QDomNode, context: QgsReadWriteContext) bool
Parameters
Return type

bool

receivers(self, PYQT_SIGNAL) int
reindex(self, transform: QgsCoordinateTransform, renumber: bool) bool

Re-indexes the faces and vertices, and renumber the indexes if renumber is True. rebuilds the triangular mesh and its spatial index with transform, clean the undostack

Returns False if the operation fails

New in version 3.22.

Parameters
Return type

bool

reload(self)
rendererSettings(self) QgsMeshRendererSettings

Returns renderer settings

Return type

QgsMeshRendererSettings

resetDatasetGroupTreeItem(self)

Reset the dataset group tree item to default from provider

New in version 3.14.

rollBackFrameEditing(self, transform: QgsCoordinateTransform, continueEditing: bool = True) bool

Rolls Back edition of the mesh frame. Reload mesh from file, rebuilds the triangular mesh and its spatial index with transform, Continue editing with the same mesh editor if continueEditing is True

Return type

bool

Returns

True if the rollback succeeds

New in version 3.22.

Parameters
saveDataset(self, path: str, datasetGroupIndex: int, driver: str) bool

Saves datasets group on file with the specified driver

Parameters
  • path (str) – the path of the file

  • datasetGroupIndex (int) – the index of the dataset group

  • driver (str) – the driver to used for saving

Return type

bool

Returns

false if succeeds

New in version 3.16.

selectFacesByExpression(self, expression: QgsExpression) List[int]

Returns a list of faces indexes that meet the condition defined by expression with the context expressionContext

To express the relation with a face, the expression can be defined with function returning value linked to the current face, like ” $face_area “

New in version 3.22.

Parameters

expression (QgsExpression) –

Return type

List[int]

selectVerticesByExpression(self, expression: QgsExpression) List[int]

Returns a list of vertex indexes that meet the condition defined by expression with the context expressionContext

To express the relation with a vertex, the expression can be defined with function returning value linked to the current vertex, like ” $vertex_z “, “$vertex_as_point”

New in version 3.22.

Parameters

expression (QgsExpression) –

Return type

List[int]

sender(self) QObject
senderSignalIndex(self) int
setDatasetGroupTreeRootItem(self, rootItem: QgsMeshDatasetGroupTreeItem)

Sets the root items of the dataset group tree item. Changes active dataset groups if those one are not enabled anymore :

  • new active scalar dataset group is the first root item enabled child

  • new active vector dataset group is none

Doesn’t take ownership of the pointed item, the root item is cloned.

Parameters

rootItem (QgsMeshDatasetGroupTreeItem) – the new root item

New in version 3.14.

setError(self, error: QgsError)

Sets error message

setExtent(self, rect: QgsRectangle)

Sets the extent

setProviderType(self, providerType: str)

Sets the providerType (provider key)

setReferenceTime(self, referenceTime: Union[QDateTime, datetime.datetime])

Sets the reference time of the layer

Parameters

referenceTime (Union[QDateTime) – the reference time

New in version 3.14.

setRendererSettings(self, settings: QgsMeshRendererSettings)

Sets new renderer settings

Parameters

settings (QgsMeshRendererSettings) –

setTemporalMatchingMethod(self, matchingMethod: QgsMeshDataProviderTemporalCapabilities.MatchingTemporalDatasetMethod)

Sets the method used to match the temporal dataset from a requested time, see activeVectorDatasetAtTime()

Parameters

matchingMethod (QgsMeshDataProviderTemporalCapabilities.MatchingTemporalDatasetMethod) – the matching method

New in version 3.14.

setTimeSettings(self, settings: QgsMeshTimeSettings)

Sets time format settings

New in version 3.8.

Parameters

settings (QgsMeshTimeSettings) –

setTransformContext(self, transformContext: QgsCoordinateTransformContext)

Sets the coordinate transform context to transformContext.

New in version 3.8.

Parameters

transformContext (QgsCoordinateTransformContext) –

setValid(self, valid: bool)

Sets whether layer is valid or not

snapOnElement(self, elementType: QgsMesh.ElementType, point: QgsPointXY, searchRadius: float) QgsPointXY

Returns the position of the snapped point on the mesh element closest to point intersecting with the searching area defined by point and searchRadius

For vertex, the snapped position is the vertex position For edge, the snapped position is the projected point on the edge, extremity of edge if outside the edge For face, the snapped position is the centroid of the face The returned position is in map coordinates.

Note

It uses previously cached and indexed triangular mesh and so if the layer has not been rendered previously (e.g. when used in a script) it returns empty QgsPointXY

Parameters
  • elementType (QgsMesh.ElementType) – the type of element to snap

  • point (QgsPointXY) – the center of the search area in map coordinates

  • searchRadius (float) – the radius of the search area in map units

Return type

QgsPointXY

Returns

the position of the snapped point on the closest element, empty QgsPointXY if no element of type elementType

New in version 3.14.

startFrameEditing(self, transform: QgsCoordinateTransform) bool

Starts edition of the mesh frame. Coordinate transform used to initialize the triangular mesh if needed. This operation will disconnect the mesh layer from the data provider anf removes all existing dataset group

New in version 3.22.

Parameters

transform (QgsCoordinateTransform) –

Return type

bool

staticScalarDatasetIndex(self) QgsMeshDatasetIndex

Returns the static scalar dataset index that is rendered if the temporal properties is not active

New in version 3.14.

Return type

QgsMeshDatasetIndex

staticVectorDatasetIndex(self) QgsMeshDatasetIndex

Returns the static vector dataset index that is rendered if the temporal properties is not active

New in version 3.14.

Return type

QgsMeshDatasetIndex

stopFrameEditing(self, transform: QgsCoordinateTransform)

Stops edition of the mesh, re-indexes the faces and vertices, rebuilds the triangular mesh and its spatial index with transform, clean the undostack

New in version 3.22.

Parameters

transform (QgsCoordinateTransform) –

subLayers(self) List[str]
Return type

List[str]

supportsEditing(self) bool
Return type

bool

temporalProperties(self) QgsMapLayerTemporalProperties
Return type

QgsMapLayerTemporalProperties

timeSettings(self) QgsMeshTimeSettings

Returns time format settings

New in version 3.8.

Return type

QgsMeshTimeSettings

timeSettingsChanged

Emitted when time format is changed

New in version 3.8: [signal]

timerEvent(self, QTimerEvent)
updateTriangularMesh(self, transform: QgsCoordinateTransform = QgsCoordinateTransform())

Gets native mesh and updates (creates if it doesn’t exist) the base triangular mesh

Parameters

transform (QgsCoordinateTransform = QgsCoordinateTransform()) – Transformation from layer CRS to destination (e.g. map) CRS. With invalid transform, it keeps the native mesh CRS

New in version 3.14.

writeCommonStyle(self, layerElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext, categories: Union[QgsMapLayer.StyleCategories, QgsMapLayer.StyleCategory] = QgsMapLayer.AllStyleCategories)

Write style data common to all layer types

New in version 3.0.

writeCustomProperties(self, layerNode: QDomNode, doc: QDomDocument)

Write custom properties to project file.

writeStyle(self, node: QDomNode, doc: QDomDocument, errorMessage: str, context: QgsReadWriteContext, categories: Union[QgsMapLayer.StyleCategories, QgsMapLayer.StyleCategory] = QgsMapLayer.AllStyleCategories) bool
Parameters
Return type

bool

writeStyleManager(self, layerNode: QDomNode, doc: QDomDocument)

Write style manager’s configuration (if exists). To be called by subclasses.

writeSymbology(self, node: QDomNode, doc: QDomDocument, errorMessage: str, context: QgsReadWriteContext, categories: Union[QgsMapLayer.StyleCategories, QgsMapLayer.StyleCategory] = QgsMapLayer.AllStyleCategories) bool
Parameters
Return type

bool

writeXml(self, layer_node: QDomNode, doc: QDomDocument, context: QgsReadWriteContext) bool
Parameters
Return type

bool