Subgroup: Vector

Class: QgsVectorLayerJoinBuffer

class qgis.core.QgsVectorLayerJoinBuffer

Bases: PyQt5.QtCore.QObject, qgis._core.QgsFeatureSink

Manages joined fields for a vector layer*

Methods

addFeature Adds a single feature to the sink.
addFeatures Adds a list of features in joined layers.
addJoin Joins another vector layer to this layer
blockSignals
changeAttributeValue Changes attribute value in joined layers.
childEvent
children
clone Create a copy of the join buffer
connectNotify
containsJoins Quick way to test if there is any join at all
createJoinCaches Calls cacheJoinLayer() for all vector joins
customEvent
deleteFeature Deletes a feature from joined layers.
deleteFeatures Deletes a list of features from joined layers.
deleteLater
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
event
eventFilter
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
flushBuffer Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink’s destination.
inherits
installEventFilter
isAuxiliaryJoin Returns true if the join information is about auxiliary layer, false otherwise
isSignalConnected
isWidgetType
isWindowType
joinForFieldIndex Finds the vector join for a layer field index.
joinSubsetIndices Return a vector of indices for use in join based on field names from the layer
joinedFeatureOf Returns the joined feature corresponding to the feature.
joinedFieldsOffset Find out what is the first index of the join within fields.
joinsWhereFieldIsId Returns joins where the field of a target layer is considered as an id.
killTimer
metaObject
moveToThread
objectName
parent
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
readXml Reads joins from project file.
receivers
removeEventFilter
removeJoin Removes a vector layer join
resolveReferences Resolves layer IDs of joined layers using given project’s available layers
sender
senderSignalIndex
setObjectName
setParent
setProperty
signalsBlocked
startTimer
targetedFeatureOf Returns the targeted feature corresponding to the joined feature.
thread
timerEvent
tr
updateFields Updates field map with joined attributes
vectorJoins
writeXml Saves mVectorJoins to xml under the layer node

Attributes

FastInsert
destroyed destroyed(self, QObject = None) [signal]
joinedFieldsChanged Emitted whenever the list of joined fields changes (e.g.
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
addFeatures(self, features: object, flags: Union[QgsFeatureSink.Flags, QgsFeatureSink.Flag] = 0) → bool

Adds a list of features in joined layers. Features given in parameter are those added in target layer. If a corresponding joined feature yet exists in a joined layer, then this feature is just updated. Note that if a corresponding joined feature has only empty fields, then it’s not created nor added.

Parameters:
  • features – The list of features added in the target layer
  • flags – Unused parameter
Returns:

false if an error happened, true otherwise

New in version 3.0.

addJoin(self, joinInfo: QgsVectorLayerJoinInfo) → bool

Joins another vector layer to this layer

Parameters:joinInfo – join object containing join layer id, target and source field
Returns:(since 2.6) whether the join was successfully added *
changeAttributeValue(self, fid: int, field: int, newValue: Any, oldValue: Any = None) → bool

Changes attribute value in joined layers. The feature id given in parameter is the one added in target layer. If the corresponding joined feature does not exist in a joined layer, then it’s automatically created if its fields are not empty.

Parameters:
  • fid – The feature id
  • field – The field to update
  • newValue – The new value of the attribute
  • oldValue – The old value of the attribute
Returns:

false if an error happened, true otherwise

New in version 3.0.

childEvent()
clone(self) → QgsVectorLayerJoinBuffer

Create a copy of the join buffer

New in version 2.6.

connectNotify()
containsJoins(self) → bool

Quick way to test if there is any join at all

createJoinCaches(self)

Calls cacheJoinLayer() for all vector joins

customEvent()
deleteFeature(self, fid: int) → bool

Deletes a feature from joined layers. The feature id given in parameter is the one coming from the target layer.

Parameters:fid – The feature id from the target layer to delete
Returns:false if an error happened, true otherwise

New in version 3.0.

deleteFeatures(self, fids: object) → bool

Deletes a list of features from joined layers. Feature ids given in aprameter are those coming from the target layer.

Parameters:fids – Feature ids from the target layer to delete
Returns:false if an error happened, true otherwise

New in version 3.0.

disconnectNotify()
isAuxiliaryJoin(self, info: QgsVectorLayerJoinInfo) → bool

Returns true if the join information is about auxiliary layer, false otherwise

Parameters:info – The join information
Returns:true if the join information is about auxiliary layer, false otherwise

New in version 3.0.

isSignalConnected()
joinForFieldIndex(self, index: int, fields: QgsFields) → Tuple[QgsVectorLayerJoinInfo, int]

Finds the vector join for a layer field index.

Parameters:
  • index – this layers attribute index
  • fields – fields of the vector layer (including joined fields)
  • sourceFieldIndex – Output: field’s index in source layer *
joinSubsetIndices(joinLayer: QgsVectorLayer, joinFieldsSubset: Iterable[str]) → List[int]

Return a vector of indices for use in join based on field names from the layer

New in version 2.6.

joinedFeatureOf(self, info: QgsVectorLayerJoinInfo, feature: QgsFeature) → QgsFeature

Returns the joined feature corresponding to the feature.

Parameters:
  • info – the vector join information
  • feature – the feature of the target layer

New in version 3.0.

joinedFieldsChanged

Emitted whenever the list of joined fields changes (e.g. added join or joined layer’s fields change)

New in version 2.6: [signal]

joinedFieldsOffset(self, info: QgsVectorLayerJoinInfo, fields: QgsFields) → int

Find out what is the first index of the join within fields. Returns -1 if join is not present

New in version 2.6.

joinsWhereFieldIsId(self, field: QgsField) → object

Returns joins where the field of a target layer is considered as an id.

Parameters:field – the field of a target layer
Returns:a list of vector joins

New in version 3.0.

readXml(self, layer_node: QDomNode)

Reads joins from project file. Does not resolve layer IDs to layers - call resolveReferences() afterwards

receivers()
removeJoin(self, joinLayerId: str) → bool

Removes a vector layer join

Returns:true if join was found and successfully removed *
resolveReferences(self, project: QgsProject)

Resolves layer IDs of joined layers using given project’s available layers

New in version 3.0.

sender()
senderSignalIndex()
targetedFeatureOf(self, info: QgsVectorLayerJoinInfo, feature: QgsFeature) → QgsFeature

Returns the targeted feature corresponding to the joined feature.

Parameters:
  • info – the vector join information
  • feature – the feature of the joined layer

New in version 3.0.

timerEvent()
updateFields(self, fields: QgsFields)

Updates field map with joined attributes

Parameters:fields – map to append joined attributes
vectorJoins(self) → object
writeXml(self, layer_node: QDomNode, document: QDomDocument)

Saves mVectorJoins to xml under the layer node