Class: QgsLayoutAtlas¶
Used to render QgsLayout
as an atlas, by iterating over the
features from an associated vector layer.
QgsLayoutAtlas
implement the
QgsAbstractLayoutIterator
interface, allowing them to be
used directly with QgsLayoutExporter
to automatically output
all pages from the atlas.
For QgsPrintLayout
layouts, it is not necessary to manually
construct a QgsLayoutAtlas
object. Instead, the atlas
attached to the print layout should be used. This can be retrieved by
calling QgsPrintLayout.atlas()
.
Class Hierarchy¶
Base classes¶
An abstract base class for |
|
An interface for layout objects which can be stored and read from DOM elements. |
|
Interface for layout objects which support undo/redo commands. |
|
Abstract interface for generating an expression context. |
Methods
Returns the coverage layer used for the atlas features. |
|
Returns the current feature number, where a value of 0 corresponds to the first feature. |
|
Returns the current feature filename. |
|
Returns whether the atlas generation is enabled |
|
Returns the filename expression used for generating output filenames for each atlas page. |
|
Returns the expression used for filtering features in the coverage layer. |
|
Returns |
|
Seeks to the first feature, returning |
|
Returns |
|
Seeks to the last feature, returning |
|
Returns |
|
Returns the calculated name for a specified atlas page number. |
|
Returns the expression (or field name) used for calculating the page name. |
|
Iterates to the previous feature, returning |
|
Refreshes the current atlas feature, by refetching its attributes from the vector layer provider |
|
Seeks to the specified feature number. |
|
Sets the coverage layer to use for the atlas features. |
|
Sets whether the atlas is enabled. |
|
Sets the filename expression used for generating output filenames for each atlas page. |
|
Sets the expression used for filtering features in the coverage layer. |
|
Sets whether features should be filtered in the coverage layer. |
|
Sets whether the coverage layer should be hidden in map items in the layouts. |
|
Sets whether the rendering of the coverage layer should be limited to the current feature. |
|
Sets the expression (or field name) used for calculating the page name. |
|
Sets whether features should be sorted in an ascending order. |
|
Sets the expression (or field name) to use for sorting features. |
|
Sets whether features should be sorted in the atlas. |
|
Returns |
|
Returns the expression (or field name) to use for sorting features. |
|
Returns |
|
Requeries the current atlas coverage layer and applies filtering and sorting. |
Signals
Emitted when one of the atlas parameters changes. |
|
Emitted when the coverage layer for the atlas changes. |
|
Emitted when the current atlas feature changes. |
|
Emitted when the atlas has an updated status bar message. |
|
Emitted when the number of features for the atlas changes. |
|
Emitted when atlas rendering has begun. |
|
Emitted when atlas rendering has ended. |
|
Emitted when atlas is enabled or disabled. |
- class qgis.core.QgsLayoutAtlas[source]¶
Bases:
QObject
,QgsAbstractLayoutIterator
,QgsLayoutSerializableObject
,QgsExpressionContextGenerator
- __init__(layout: QgsLayout | None)
Constructor for new QgsLayoutAtlas.
- Parameters:
layout (Optional[QgsLayout])
- coverageLayer(self) QgsVectorLayer | None [source]¶
Returns the coverage layer used for the atlas features.
See also
- Return type:
Optional[QgsVectorLayer]
- signal coverageLayerChanged(layer: QgsVectorLayer)[source]¶
Emitted when the coverage layer for the atlas changes.
- Parameters:
layer (QgsVectorLayer)
- currentFeatureNumber(self) int [source]¶
Returns the current feature number, where a value of 0 corresponds to the first feature.
- Return type:
int
- currentFilename(self) str [source]¶
Returns the current feature filename.
See also
See also
- Return type:
str
- enabled(self) bool [source]¶
Returns whether the atlas generation is enabled
See also
- Return type:
bool
- signal featureChanged(feature: QgsFeature)[source]¶
Emitted when the current atlas
feature
changes.- Parameters:
feature (QgsFeature)
- filenameExpression(self) str [source]¶
Returns the filename expression used for generating output filenames for each atlas page.
See also
See also
- Return type:
str
- filterExpression(self) str [source]¶
Returns the expression used for filtering features in the coverage layer.
This property has no effect is
filterFeatures()
isFalse
.See also
See also
- Return type:
str
- filterFeatures(self) bool [source]¶
Returns
True
if features should be filtered in the coverage layer.See also
See also
- Return type:
bool
- first(self) bool [source]¶
Seeks to the first feature, returning
False
if no feature was found.See also
next()
See also
See also
See also
- Return type:
bool
- hideCoverage(self) bool [source]¶
Returns
True
if the atlas is set to hide the coverage layer.See also
- Return type:
bool
- last(self) bool [source]¶
Seeks to the last feature, returning
False
if no feature was found.See also
next()
See also
See also
See also
- Return type:
bool
- limitCoverageLayerRenderToCurrentFeature(self) bool [source]¶
Returns
True
if the atlas is set to limit rendering on the coverage layer to the current feature.See also
Added in version 4.0.
- Return type:
bool
- signal messagePushed(message: str)[source]¶
Emitted when the atlas has an updated status bar
message
.- Parameters:
message (str)
- nameForPage(self, page: int) str [source]¶
Returns the calculated name for a specified atlas
page
number. Page numbers start at 0.See also
- Parameters:
page (int)
- Return type:
str
- signal numberFeaturesChanged(numFeatures: int)[source]¶
Emitted when the number of features for the atlas changes.
- Parameters:
numFeatures (int)
- pageNameExpression(self) str [source]¶
Returns the expression (or field name) used for calculating the page name.
See also
See also
- Return type:
str
- previous(self) bool [source]¶
Iterates to the previous feature, returning
False
if no previous feature exists.See also
next()
See also
See also
See also
- Return type:
bool
- refreshCurrentFeature(self)[source]¶
Refreshes the current atlas feature, by refetching its attributes from the vector layer provider
- seekTo(self, feature: int) bool [source]¶
Seeks to the specified
feature
number.See also
See also
See also
next()
See also
- Parameters:
feature (int)
- Return type:
bool
- seekTo(self, feature: QgsFeature) bool [source]
Seeks to the specified
feature
.See also
See also
See also
next()
See also
- Parameters:
feature (
QgsFeature
)- Return type:
bool
- setCoverageLayer(self, layer: QgsVectorLayer | None)[source]¶
Sets the coverage
layer
to use for the atlas features.See also
- Parameters:
layer (Optional[QgsVectorLayer])
- setEnabled(self, enabled: bool)[source]¶
Sets whether the atlas is
enabled
.See also
- Parameters:
enabled (bool)
- setFilenameExpression(self, expression: str | None)[source]¶
Sets the filename
expression
used for generating output filenames for each atlas page. If an invalid expression is passed,False
will be returned anderrorString
will be set to the expression error.See also
See also
- Parameters:
expression (Optional[str]) -> (bool)
- setFilterExpression(self, expression: str | None)[source]¶
Sets the
expression
used for filtering features in the coverage layer.This property has no effect is
filterFeatures()
isFalse
.If an invalid expression is passed,
False
will be returned anderrorString
will be set to the expression error.See also
See also
- Parameters:
expression (Optional[str]) -> (bool)
- setFilterFeatures(self, filtered: bool)[source]¶
Sets whether features should be
filtered
in the coverage layer.See also
See also
- Parameters:
filtered (bool)
- setHideCoverage(self, hide: bool)[source]¶
Sets whether the coverage layer should be hidden in map items in the layouts.
See also
- Parameters:
hide (bool)
- setLimitCoverageLayerRenderToCurrentFeature(self, limit: bool)[source]¶
Sets whether the rendering of the coverage layer should be limited to the current feature.
See also
Added in version 4.0.
- Parameters:
limit (bool)
- setPageNameExpression(self, expression: str | None)[source]¶
Sets the
expression
(or field name) used for calculating the page name.See also
- Parameters:
expression (Optional[str])
- setSortAscending(self, ascending: bool)[source]¶
Sets whether features should be sorted in an ascending order.
This property has no effect is
sortFeatures()
isFalse
.See also
See also
See also
- Parameters:
ascending (bool)
- setSortExpression(self, expression: str | None)[source]¶
Sets the
expression
(or field name) to use for sorting features.This property has no effect is
sortFeatures()
isFalse
.See also
See also
See also
- Parameters:
expression (Optional[str])
- setSortFeatures(self, enabled: bool)[source]¶
Sets whether features should be sorted in the atlas.
See also
See also
See also
- Parameters:
enabled (bool)
- sortAscending(self) bool [source]¶
Returns
True
if features should be sorted in an ascending order.This property has no effect is
sortFeatures()
isFalse
.See also
See also
See also
- Return type:
bool
- sortExpression(self) str [source]¶
Returns the expression (or field name) to use for sorting features.
This property has no effect is
sortFeatures()
isFalse
.See also
See also
See also
- Return type:
str
- sortFeatures(self) bool [source]¶
Returns
True
if features should be sorted in the atlas.See also
See also
See also
- Return type:
bool