Subgroup: Layout

Class: QgsLayoutAtlas

class qgis.core.QgsLayoutAtlas(layout: QgsLayout)

Bases: PyQt5.QtCore.QObject, qgis._core.QgsAbstractLayoutIterator, qgis._core.QgsLayoutSerializableObject

Constructor for new QgsLayoutAtlas.

Class used to render an Atlas, iterating over geometry features. prepareForFeature() modifies the atlas map’s extent to zoom on the given feature. This class is used for printing, exporting to PDF and images.

Note

This class should not be created directly. For the atlas to function correctly the atlasComposition() property for QgsComposition should be used to retrieve a QgsLayoutAtlas which is automatically created and attached to the composition.

New in version 3.0: Methods

beginRender
childEvent
connectNotify
count
coverageLayer Returns the coverage layer used for the atlas features.
currentFeatureNumber Returns the current feature number, where a value of 0 corresponds to the first feature.
currentFilename Returns the current feature filename.
customEvent
disconnectNotify
enabled Returns whether the atlas generation is enabled
endRender
filePath
filenameExpression Returns the filename expression used for generating output filenames for each atlas page.
filterExpression Returns the expression used for filtering features in the coverage layer.
filterFeatures Returns true if features should be filtered in the coverage layer.
first Seeks to the first feature, returning false if no feature was found.
hideCoverage Returns true if the atlas is set to hide the coverage layer.
isSignalConnected
last Seeks to the last feature, returning false if no feature was found.
layout
nameForPage Returns the calculated name for a specified atlas page number.
next
pageNameExpression Returns the expression (or field name) used for calculating the page name.
previous Iterates to the previous feature, returning false if no previous feature exists.
readXml
receivers
refreshCurrentFeature Refreshes the current atlas feature, by refetching its attributes from the vector layer provider
seekTo Seeks to the specified feature number.
sender
senderSignalIndex
setCoverageLayer Sets the coverage layer to use for the atlas features.
setEnabled Sets whether the atlas is enabled.
setFilenameExpression Sets the filename expression used for generating output filenames for each atlas page.
setFilterExpression Sets the expression used for filtering features in the coverage layer.
setFilterFeatures Sets whether features should be filtered in the coverage layer.
setHideCoverage Sets whether the coverage layer should be hidden in map items in the layouts.
setPageNameExpression Sets the expression (or field name) used for calculating the page name.
setSortAscending Sets whether features should be sorted in an ascending order.
setSortExpression Sets the expression (or field name) to use for sorting features.
setSortFeatures Sets whether features should be sorted in the atlas.
sortAscending Returns true if features should be sorted in an ascending order.
sortExpression Returns the expression (or field name) to use for sorting features.
sortFeatures Returns true if features should be sorted in the atlas.
stringType
timerEvent
updateFeatures Requeries the current atlas coverage layer and applies filtering and sorting.
writeXml

Signals

changed Emitted when one of the atlas parameters changes.
coverageLayerChanged Emitted when the coverage layer for the atlas changes.
featureChanged Is emitted when the current atlas feature changes.
messagePushed Is emitted when the atlas has an updated status bar message.
numberFeaturesChanged Emitted when the number of features for the atlas changes.
renderBegun Emitted when atlas rendering has begun.
renderEnded Emitted when atlas rendering has ended.
toggled Emitted when atlas is enabled or disabled.

Attributes

beginRender(self) → bool
changed

Emitted when one of the atlas parameters changes. [signal]

childEvent()
connectNotify()
count(self) → int
coverageLayer(self) → QgsVectorLayer

Returns the coverage layer used for the atlas features.

coverageLayerChanged

Emitted when the coverage layer for the atlas changes. [signal]

currentFeatureNumber(self) → int

Returns the current feature number, where a value of 0 corresponds to the first feature.

currentFilename(self) → str

Returns the current feature filename.

customEvent()
disconnectNotify()
enabled(self) → bool

Returns whether the atlas generation is enabled

See also

setEnabled()

endRender(self) → bool
featureChanged

Is emitted when the current atlas feature changes. [signal]

filePath(self, baseFilePath: str, extension: str) → str
filenameExpression(self) → str

Returns the filename expression used for generating output filenames for each atlas page.

filterExpression(self) → str

Returns the expression used for filtering features in the coverage layer.

This property has no effect is filterFeatures() is false.

See also

filterFeatures()

filterFeatures(self) → bool

Returns true if features should be filtered in the coverage layer.

first(self) → bool

Seeks to the first feature, returning false if no feature was found.

See also

next()

See also

previous()

See also

last()

See also

seekTo()

hideCoverage(self) → bool

Returns true if the atlas is set to hide the coverage layer.

isSignalConnected()
last(self) → bool

Seeks to the last feature, returning false if no feature was found.

See also

next()

See also

previous()

See also

first()

See also

seekTo()

layout(self) → QgsLayout
messagePushed

Is emitted when the atlas has an updated status bar message. [signal]

nameForPage(self, page: int) → str

Returns the calculated name for a specified atlas page number. Page numbers start at 0.

next(self) → bool
numberFeaturesChanged

Emitted when the number of features for the atlas changes. [signal]

pageNameExpression(self) → str

Returns the expression (or field name) used for calculating the page name.

See also

nameForPage()

previous(self) → bool

Iterates to the previous feature, returning false if no previous feature exists.

See also

next()

See also

last()

See also

first()

See also

seekTo()

readXml(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool
receivers()
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

first()

See also

previous()

See also

next()

See also

last()

seekTo(self, feature: QgsFeature) -> bool Seeks to the specified feature.

See also

first()

See also

previous()

See also

next()

See also

last()

sender()
senderSignalIndex()
setCoverageLayer(self, layer: QgsVectorLayer)

Sets the coverage layer to use for the atlas features.

See also

coverageLayer()

setEnabled(self, enabled: bool)

Sets whether the atlas is enabled.

See also

enabled()

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 and errorString will be set to the expression error.

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() is false.

If an invalid expression is passed, false will be returned and errorString will be set to the expression error.

setFilterFeatures(self, filtered: bool)

Sets whether features should be filtered in the coverage layer.

See also

filterFeatures()

setHideCoverage(self, hide: bool)

Sets whether the coverage layer should be hidden in map items in the layouts.

See also

hideCoverage()

setPageNameExpression(self, expression: str)

Sets the expression (or field name) used for calculating the page name.

setSortAscending(self, ascending: bool)

Sets whether features should be sorted in an ascending order.

This property has no effect is sortFeatures() is false.

See also

sortAscending()

setSortExpression(self, expression: str)

Sets the expression (or field name) to use for sorting features.

This property has no effect is sortFeatures() is false.

See also

sortExpression()

setSortFeatures(self, enabled: bool)

Sets whether features should be sorted in the atlas.

See also

sortFeatures()

sortAscending(self) → bool

Returns true if features should be sorted in an ascending order.

This property has no effect is sortFeatures() is false.

See also

sortFeatures()

See also

sortExpression()

sortExpression(self) → str

Returns the expression (or field name) to use for sorting features.

This property has no effect is sortFeatures() is false.

See also

sortFeatures()

See also

sortAscending()

sortFeatures(self) → bool

Returns true if features should be sorted in the atlas.

See also

sortAscending()

See also

sortExpression()

stringType(self) → str
timerEvent()
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.

writeXml(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool