Class: QgsVectorTileBasicRendererStyle

class qgis.core.QgsVectorTileBasicRendererStyle

Bases: sip.wrapper

Definition of map rendering of a subset of vector tile data. The subset of data is defined by:

  • sub-layer name

  • geometry type (a single sub-layer may have multiple geometry types)

  • filter expression

Rendering is determined by the associated symbol (QgsSymbol). Symbol has to be of the same type as the chosen geometryType() - i.e. QgsMarkerSymbol for points, QgsLineSymbol for linestrings and QgsFillSymbol for polygons.

It is possible to further constrain when this style is applied by setting a range of allowed zoom levels, or by disabling it.

New in version 3.14.

QgsVectorTileBasicRendererStyle(stName: str = ‘’, laName: str = ‘’, geomType: Qgis.GeometryType = Qgis.GeometryType.Unknown) Constructs a style object

QgsVectorTileBasicRendererStyle(other: QgsVectorTileBasicRendererStyle) Constructs a style object as a copy of another style

Methods

filterExpression

Returns filter expression (empty filter means that all features match)

geometryType

Returns type of the geometry that will be used (point / line / polygon)

isActive

Returns whether the style is active at given zoom level (also checks "enabled" flag)

isEnabled

Returns whether this style is enabled (used for rendering)

layerName

Returns name of the sub-layer to render (empty layer means that all layers match)

maxZoomLevel

Returns the maximum zoom level index (negative number means no limit).

minZoomLevel

Returns the minimum zoom level index (negative number means no limit).

readXml

Reads object content from given DOM element

setEnabled

Sets whether this style is enabled (used for rendering)

setFilterExpression

Sets filter expression (empty filter means that all features match)

setGeometryType

Sets type of the geometry that will be used (point / line / polygon)

setLayerName

Sets name of the sub-layer to render (empty layer means that all layers match)

setMaxZoomLevel

Sets maximum zoom level index (negative number means no limit).

setMinZoomLevel

Sets minimum zoom level index (negative number means no limit).

setStyleName

Sets human readable name of this style

setSymbol

Sets symbol for rendering.

styleName

Returns human readable name of this style

symbol

Returns symbol for rendering

writeXml

Writes object content to given DOM element

filterExpression(self) str

Returns filter expression (empty filter means that all features match)

Return type:

str

geometryType(self) Qgis.GeometryType

Returns type of the geometry that will be used (point / line / polygon)

Return type:

Qgis.GeometryType

isActive(self, zoomLevel: int) bool

Returns whether the style is active at given zoom level (also checks “enabled” flag)

Parameters:

zoomLevel (int) –

Return type:

bool

isEnabled(self) bool

Returns whether this style is enabled (used for rendering)

Return type:

bool

layerName(self) str

Returns name of the sub-layer to render (empty layer means that all layers match)

Return type:

str

maxZoomLevel(self) int

Returns the maximum zoom level index (negative number means no limit).

The style will be rendered if the zoom level is less than or equal to the maximum zoom.

Warning

This differs from the handling of the max zoom as defined in the MapBox Style Specifications, where the style is rendered only if the zoom level is less than the maximum zoom.

See also

minZoomLevel()

Return type:

int

minZoomLevel(self) int

Returns the minimum zoom level index (negative number means no limit).

The style will be rendered if the zoom level is greater than or equal to the this level.

See also

maxZoomLevel()

Return type:

int

readXml(self, elem: QDomElement, context: QgsReadWriteContext)

Reads object content from given DOM element

Parameters:
setEnabled(self, enabled: bool)

Sets whether this style is enabled (used for rendering)

Parameters:

enabled (bool) –

setFilterExpression(self, expr: str)

Sets filter expression (empty filter means that all features match)

Parameters:

expr (str) –

setGeometryType(self, geomType: Qgis.GeometryType)

Sets type of the geometry that will be used (point / line / polygon)

Parameters:

geomType (Qgis.GeometryType) –

setLayerName(self, name: str)

Sets name of the sub-layer to render (empty layer means that all layers match)

Parameters:

name (str) –

setMaxZoomLevel(self, maxZoom: int)

Sets maximum zoom level index (negative number means no limit).

The style will be rendered if the zoom level is less than or equal to maxZoom.

Warning

This differs from the handling of the max zoom as defined in the MapBox Style Specifications, where the style is rendered only if the zoom level is less than the maximum zoom.

See also

maxZoomLevel()

Parameters:

maxZoom (int) –

setMinZoomLevel(self, minZoom: int)

Sets minimum zoom level index (negative number means no limit).

The style will be rendered if the zoom level is greater than or equal to minZoom.

See also

minZoomLevel()

Parameters:

minZoom (int) –

setStyleName(self, name: str)

Sets human readable name of this style

Parameters:

name (str) –

setSymbol(self, sym: QgsSymbol)

Sets symbol for rendering. Takes ownership of the symbol.

Parameters:

sym (QgsSymbol) –

styleName(self) str

Returns human readable name of this style

Return type:

str

symbol(self) QgsSymbol

Returns symbol for rendering

Return type:

QgsSymbol

writeXml(self, elem: QDomElement, context: QgsReadWriteContext)

Writes object content to given DOM element

Parameters: