2

see the code example below, which will change the extent of the map item with the id "map1" in the layout named "test" to the same extent as the map canvas extent: canvas = iface.mapCanvas() manager = QgsProject.instance().layoutManager() layout = manager.layoutByName("test") mapItem = layout.itemById('map1') #make sure that it is a MapItem if type(mapItem)....


Only top voted, non community-wiki answers of a minimum length are eligible