I have used following code for selecting the features one by one. but when i run the script it is just selecting last feature and zoom it. I want to select each feature and zoom it.
def SelectFeatures(self):
layer = self.iface.activeLayer();
iter = layer.getFeatures();
for feature in iter:
geom = feature.geometry()
self.iface.mapCanvas().setSelectionColor(QColor("yellow"));
layer.setSelectedFeatures([feature.id()])
selected_features = layer.selectedFeatures()
self.iface.mapCanvas().zoomToSelected( layer )
self.iface.mapCanvas().refresh()
No comments:
Post a Comment