[Qgis-user] zoomToLayers pyqgis
Patrick Dunford
enzedrailmaps at gmail.com
Sat Nov 18 00:32:37 PST 2023
Good day to all
I want to call zoomToLayers in a pyqgis script to zoom the map canvas to
a layer which I have just applied a filter to. I am not sure how to do
it as all the documented uses of this method seem to apply to different
things than to a layer.
If the layer is not the currently active layer is there a method of this
that can be called on a particular layer or selecting a particular layer
as active then using the call that uses the active layer.
e.g.
project =QgsProject.instance()
layer = project.mapLayersByName("Live Aerial Footprints")[0]
layer.setSubsetString(aerialFilter)
# insert code here to zoom to this layer
Thanks
More information about the QGIS-User
mailing list