I create a selection with getFeatures(QgsFeatureRequest())
and I want to calculate the length of the result which is a QgsFeatureIterator
:
select = QgsExpression(" myexpression ")
selectedfeats = layer.getFeatures(QgsFeatureRequest(select ))
total = 0
for feature in selectedfeats :
geom = feature.geometry()
total += geom.length()
But it doesn't work it returns 0 whereas the selectedfeats
is not empty.
No comments:
Post a Comment