Class: QgsFeatureIterator

class qgis.core.QgsFeatureIterator

Bases: sip.wrapper

Wrapper for iterator of features from vector data provider or vector layer

QgsFeatureIterator() Construct invalid iterator

QgsFeatureIterator(iter: QgsAbstractFeatureIterator) Construct a valid iterator

QgsFeatureIterator(fi: QgsFeatureIterator) Copy constructor copies the iterator, increases ref.count

Methods

close

Call to end the iteration.

compileFailed

Indicator if there was an error when sending the compiled query to the server.

compileStatus

Returns the status of expression compilation for filter expression requests.

isClosed

find out whether the iterator is still valid or closed already

isValid

Will return if this iterator is valid.

nextFeature

Fetch next feature and stores in f, returns True on success.

rewind

Resets the iterator to the starting position.

close(self) bool

Call to end the iteration. This frees any resources used by the iterator.

Return type:

bool

compileFailed(self) bool

Indicator if there was an error when sending the compiled query to the server. This indicates that there is something wrong with the expression compiler.

Added in version 3.2.

Return type:

bool

compileStatus(self) QgsAbstractFeatureIterator.CompileStatus

Returns the status of expression compilation for filter expression requests.

Return type:

QgsAbstractFeatureIterator.CompileStatus

isClosed(self) bool

find out whether the iterator is still valid or closed already

Return type:

bool

isValid(self) bool

Will return if this iterator is valid. An invalid iterator was probably introduced by a failed attempt to acquire a connection or is a default constructed iterator.

See also

isClosed()

Return type:

bool

nextFeature(self, f: QgsFeature) bool

Fetch next feature and stores in f, returns True on success.

Parameters:

f (QgsFeature)

Return type:

bool

rewind(self) bool

Resets the iterator to the starting position.

Return type:

bool