Class: QgsVectorLayerFeatureIterator

A feature iterator which iterates over features from a QgsVectorLayer.

Class Hierarchy

Inheritance diagram of qgis.core.QgsVectorLayerFeatureIterator

Base classes

QgsAbstractFeatureIteratorFromSourceQgsVectorLayerFeatureSourceBase

Helper template that cares of two things: 1. automatic deletion of source if owned by iterator, 2. notification of open/closed iterator.

QgsAbstractFeatureIterator

Internal feature iterator to be implemented within data providers.

Abstract Methods

close

end of iterating: free the resources / lock

fetchFeature

fetch next feature, return True on success

rewind

reset the iterator to the starting position

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsVectorLayerFeatureIterator. See the FAQ for more details.

nextFeatureFilterExpression

Overrides default method as we only need to filter features in the edit buffer while for others filtering is left to the provider implementation.

prepareSimplification

Setup the simplification of geometries to fetch using the specified simplify method

class qgis.core.QgsVectorLayerFeatureIterator[source]

Bases: QgsAbstractFeatureIteratorFromSourceQgsVectorLayerFeatureSourceBase

class FetchJoinInfo

Bases: object

Join information prepared for fast attribute id mapping in QgsVectorLayerJoinBuffer.updateFeatureAttributes(). Created in the select() method of QgsVectorLayerJoinBuffer for the joins that contain fetched attributes

addJoinedAttributesCached(self, f: QgsFeature, joinValue: Any)
Parameters:
addJoinedAttributesDirect(self, f: QgsFeature, joinValue: Any)
Parameters:
attributes: QgsAttributeList

Attributes to fetch

indexOffset: int

At what position the joined fields start

joinField: int

< Index of field (of the joined layer) must have equal value

joinInfo: QgsVectorLayerJoinInfo

Canonical source of information about the join

targetField: int

Index of field (of this layer) that drives the join

abstract close(self) bool[source]

end of iterating: free the resources / lock

Return type:

bool

abstract fetchFeature(self, feature: QgsFeature) bool[source]

fetch next feature, return True on success

Parameters:

feature (QgsFeature)

Return type:

bool

virtual nextFeatureFilterExpression(self, f: QgsFeature) bool[source]

Overrides default method as we only need to filter features in the edit buffer while for others filtering is left to the provider implementation.

Parameters:

f (QgsFeature)

Return type:

bool

virtual prepareSimplification(self, simplifyMethod: QgsSimplifyMethod) bool[source]

Setup the simplification of geometries to fetch using the specified simplify method

Parameters:

simplifyMethod (QgsSimplifyMethod)

Return type:

bool

abstract rewind(self) bool[source]

reset the iterator to the starting position

Return type:

bool