Class: QgsMapCanvasUtils¶
Utility functions for working with QgsMapCanvas
widgets.
Added in version 3.14.
Static Methods
Constructs a filter to use for selecting features from the given layer, in order to apply filters which prevent some features from being displayed (e.g. as a result of temporal range of the canvas and the layer's temporal settings). |
|
Flashes features from the specified layer which match the given filter expression string with a map canvas. |
|
Zooms a map canvas to features from the specified layer which match the given filter expression string. |
- class qgis.gui.QgsMapCanvasUtils[source]¶
Bases:
object
- static filterForLayer(canvas: QgsMapCanvas | None, layer: QgsVectorLayer | None) str [source]¶
Constructs a filter to use for selecting features from the given
layer
, in order to apply filters which prevent some features from being displayed (e.g. as a result of temporal range of the canvas and the layer’s temporal settings).Will return an empty string if no filtering is required, or “
False
” if ALL features are filtered out by the canvas.Added in version 3.26.
- Parameters:
canvas (Optional[QgsMapCanvas])
layer (Optional[QgsVectorLayer])
- Return type:
str
- static flashMatchingFeatures(canvas: QgsMapCanvas | None, layer: QgsVectorLayer | None, filter: str | None) int [source]¶
Flashes features from the specified
layer
which match the givenfilter
expression string with a mapcanvas
.The total count of matching features will be returned.
- Parameters:
canvas (Optional[QgsMapCanvas])
layer (Optional[QgsVectorLayer])
filter (Optional[str])
- Return type:
int
- static zoomToMatchingFeatures(canvas: QgsMapCanvas | None, layer: QgsVectorLayer | None, filter: str | None) int [source]¶
Zooms a map
canvas
to features from the specifiedlayer
which match the givenfilter
expression string.The total count of matching features will be returned.
- Parameters:
canvas (Optional[QgsMapCanvas])
layer (Optional[QgsVectorLayer])
filter (Optional[str])
- Return type:
int