2

Is it possible to zoom to features selected from multiple layers in QGIS?

1

1 Answer 1

4

As far as I know there is no any option in menus, but you can zoom to features which are selected in multiple layers using Python.

Run the following script in QGIS Python Editor.

layers = QgsProject.instance().mapLayers().values()

extent = QgsRectangle()

for layer in layers:
    extent.combineExtentWith(layer.boundingBoxOfSelected())
    
iface.mapCanvas().setExtent(extent)
iface.mapCanvas().refresh()

enter image description here

1
  • I used it with a personal geodatabase layer and a shapefile and in that case it does not work even after I updated the extents of each layer
    – nanunga
    Nov 30 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.