When I need to zoom to a feature, I have to select it first using layer.select(feature.id())
then I can zoom using mapCanvas.zoomToSelected(layer)
.
layer = iface.activeLayer()
layer.select(1)
iface.mapCanvas().zoomToSelected(layer)
QgsMapCanvas
has only zoomToSelected()
method related to a layer. My problem is that I should not change the currently selected features when I want to zoom to another feature.
Is there a way to zoom to a feature without selecting it?