TransWikia.com

Zooming to selected features from multiple layers using QGIS

Geographic Information Systems Asked by niall phelan on March 18, 2021

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

One Answer

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

Answered by Kadir Şahbaz on March 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP