File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -1544,12 +1544,17 @@ def zoom_to_layer(layer):
15441544
15451545 # Transform extent from layer CRS to canvas CRS if needed
15461546 if layer .crs () != iface .mapCanvas ().mapSettings ().destinationCrs ():
1547- transform = QgsCoordinateTransform (
1548- layer .crs (),
1549- iface .mapCanvas ().mapSettings ().destinationCrs (),
1550- QgsProject .instance ()
1551- )
1552- extent = transform .transformBoundingBox (extent )
1547+ try :
1548+ transform = QgsCoordinateTransform (
1549+ layer .crs (),
1550+ iface .mapCanvas ().mapSettings ().destinationCrs (),
1551+ QgsProject .instance ()
1552+ )
1553+ extent = transform .transformBoundingBox (extent )
1554+ except Exception as e :
1555+ msg = f"Failed to transform coordinates for layer '{ layer .name ()} ': { str (e )} "
1556+ show_warning (msg )
1557+ return
15531558
15541559 # Set canvas extent
15551560 iface .mapCanvas ().setExtent (extent )
You can’t perform that action at this time.
0 commit comments