Class: QgsLayoutAtlas¶
- class qgis.core.QgsLayoutAtlas¶
Bases:
PyQt5.QtCore.QObject
,QgsAbstractLayoutIterator
,QgsLayoutSerializableObject
,QgsExpressionContextGenerator
Class used to render
QgsLayout
as an atlas, by iterating over the features from an associated vector layer.QgsLayoutAtlas
implement theQgsAbstractLayoutIterator
interface, allowing them to be used directly withQgsLayoutExporter
to automatically output all pages from the atlas.For
QgsPrintLayout
layouts, it is not necessary to manually construct aQgsLayoutAtlas
object. Instead, the atlas attached to the print layout should be used. This can be retrieved by callingQgsPrintLayout.atlas()
.New in version 3.0.
QgsLayoutAtlas(layout:
QgsLayout
) Constructor for new QgsLayoutAtlas.Methods
- rtype:
bool
- rtype:
int
Returns the coverage layer used for the atlas features.
- rtype:
QgsExpressionContext
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
- rtype:
bool
- param baseFilePath:
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
True
if features should be filtered in the coverage layer.Seeks to the first feature, returning
False
if no feature was found.Returns
True
if the atlas is set to hide the coverage layer.Seeks to the last feature, returning
False
if no feature was found.- rtype:
QgsLayout
Returns the calculated name for a specified atlas
page
number.- rtype:
bool
Returns the expression (or field name) used for calculating the page name.
Iterates to the previous feature, returning
False
if no previous feature exists.- param element:
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 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
True
if features should be sorted in an ascending order.Returns the expression (or field name) to use for sorting features.
Returns
True
if features should be sorted in the atlas.- rtype:
str
Requeries the current atlas coverage layer and applies filtering and sorting.
- param parentElement:
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- beginRender(self) bool ¶
- Return type:
bool
- changed¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- count(self) int ¶
- Return type:
int
- coverageLayer(self) QgsVectorLayer ¶
Returns the coverage layer used for the atlas features.
See also
- Return type:
- coverageLayerChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- createExpressionContext(self) QgsExpressionContext ¶
- Return type:
- currentFeatureNumber(self) int ¶
Returns the current feature number, where a value of 0 corresponds to the first feature.
- Return type:
int
- currentFilename(self) str ¶
Returns the current feature filename.
See also
See also
- Return type:
str
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- enabled(self) bool ¶
Returns whether the atlas generation is enabled
See also
- Return type:
bool
- endRender(self) bool ¶
- Return type:
bool
- featureChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- filePath(self, baseFilePath: str, extension: str) str ¶
- Parameters:
baseFilePath (str) –
extension (str) –
- Return type:
str
- filenameExpression(self) str ¶
Returns the filename expression used for generating output filenames for each atlas page.
See also
See also
- Return type:
str
- filterExpression(self) str ¶
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 ¶
Returns
True
if features should be filtered in the coverage layer.See also
See also
- Return type:
bool
- first(self) bool ¶
Seeks to the first feature, returning
False
if no feature was found.See also
See also
See also
See also
- Return type:
bool
- hideCoverage(self) bool ¶
Returns
True
if the atlas is set to hide the coverage layer.See also
- Return type:
bool
- isSignalConnected(self, QMetaMethod) bool ¶
- last(self) bool ¶
Seeks to the last feature, returning
False
if no feature was found.See also
See also
See also
See also
- Return type:
bool
- messagePushed¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- nameForPage(self, page: int) str ¶
Returns the calculated name for a specified atlas
page
number. Page numbers start at 0.See also
- Parameters:
page (int) –
- Return type:
str
- next(self) bool ¶
- Return type:
bool
- numberFeaturesChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- pageNameExpression(self) str ¶
Returns the expression (or field name) used for calculating the page name.
See also
See also
- Return type:
str
- previous(self) bool ¶
Iterates to the previous feature, returning
False
if no previous feature exists.See also
See also
See also
See also
- Return type:
bool
- readXml(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
- Parameters:
element (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type:
bool
- receivers(self, PYQT_SIGNAL) int ¶
- refreshCurrentFeature(self)¶
Refreshes the current atlas feature, by refetching its attributes from the vector layer provider
- renderBegun¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- renderEnded¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- seekTo(self, feature: int) bool ¶
Seeks to the specified
feature
number.See also
See also
See also
See also
seekTo(self, feature:
QgsFeature
) -> bool Seeks to the specifiedfeature
.See also
See also
See also
See also
- Parameters:
feature (int) –
- Return type:
bool
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setCoverageLayer(self, layer: QgsVectorLayer)¶
Sets the coverage
layer
to use for the atlas features.See also
- Parameters:
layer (QgsVectorLayer) –
- setEnabled(self, enabled: bool)¶
Sets whether the atlas is
enabled
.See also
- Parameters:
enabled (bool) –
- setFilenameExpression(self, expression: str) Tuple[bool, str] ¶
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 (str) –
- Return type:
Tuple[bool, str]
- setFilterExpression(self, expression: str) Tuple[bool, str] ¶
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 (str) –
- Return type:
Tuple[bool, str]
- setFilterFeatures(self, filtered: bool)¶
Sets whether features should be
filtered
in the coverage layer.See also
See also
- Parameters:
filtered (bool) –
- setHideCoverage(self, hide: bool)¶
Sets whether the coverage layer should be hidden in map items in the layouts.
See also
- Parameters:
hide (bool) –
- setPageNameExpression(self, expression: str)¶
Sets the
expression
(or field name) used for calculating the page name.See also
- Parameters:
expression (str) –
- setSortAscending(self, ascending: bool)¶
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)¶
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 (str) –
- setSortFeatures(self, enabled: bool)¶
Sets whether features should be sorted in the atlas.
See also
See also
See also
- Parameters:
enabled (bool) –
- sortAscending(self) bool ¶
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 ¶
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 ¶
Returns
True
if features should be sorted in the atlas.See also
See also
See also
- Return type:
bool
- stringType(self) str ¶
- Return type:
str
- timerEvent(self, QTimerEvent)¶
- toggled¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- updateFeatures(self) int ¶
Requeries the current atlas coverage layer and applies filtering and sorting. Returns number of matching features.
- Return type:
int
- writeXml(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
- Parameters:
parentElement (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type:
bool