Class: QgsLayoutAtlas¶
-
class
qgis.core.
QgsLayoutAtlas
(layout: QgsLayout)¶ Bases:
PyQt5.QtCore.QObject
,QgsAbstractLayoutIterator
,QgsLayoutSerializableObject
,QgsExpressionContextGenerator
Constructor for new QgsLayoutAtlas.
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.
- Parameters
layout –
-
beginRender
(self) → bool¶ - Return type
bool
-
changed
¶ Emitted when one of the atlas parameters changes. [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
¶ Emitted when the coverage layer for the atlas changes. [signal]
- Parameters
layer (QgsVectorLayer) –
-
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
¶ Emitted when the current atlas
feature
changes. [signal]- Parameters
feature (QgsFeature) –
-
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
¶ Emitted when the atlas has an updated status bar
message
. [signal]- Parameters
message (str) –
-
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
¶ Emitted when the number of features for the atlas changes. [signal]
- Parameters
numFeatures (int) –
-
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
¶ Emitted when atlas rendering has begun. [signal]
-
renderEnded
¶ Emitted when atlas rendering has ended. [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
¶ Emitted when atlas is enabled or disabled. [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