You can also use a small Python script reworked after http://docs.qgis.org/2.6/en/docs/pyqgis_developer_cookbook/canvas.html (note QString is not used anymore, the doc needs an update)
# Open a new map window with selected layer and three navigation tools
# Run as below in pyqgis console in qgis
# >>> import mywnd
# >>> w1 = mywnd.MyWnd("MyLayername1")
# >>> w1.show()
# >>> w2 = mywnd.MyWnd("MyLayername2")
# >>> w2.show()
#....
from qgis.gui import *
from qgis.core import *
from PyQt4.QtGui import QAction, QMainWindow
from PyQt4.QtCore import SIGNAL, Qt
class MyWnd(QMainWindow):
def __init__(self, layername):
QMainWindow.__init__(self)
layer = QgsMapLayerRegistry.instance().mapLayersByName(layername)[0]
self.canvas = QgsMapCanvas()
self.canvas.setCanvasColor(Qt.white)
self.canvas.setExtent(layer.extent())
self.canvas.setLayerSet( [ QgsMapCanvasLayer(layer) ] )
self.setCentralWidget(self.canvas)
actionZoomIn = QAction("Zoom in", self)
actionZoomOut = QAction("Zoom out", self)
actionPan = QAction("Pan", self)
actionZoomIn.setCheckable(True)
actionZoomOut.setCheckable(True)
actionPan.setCheckable(True)
self.connect(actionZoomIn, SIGNAL("triggered()"), self.zoomIn)
self.connect(actionZoomOut, SIGNAL("triggered()"), self.zoomOut)
self.connect(actionPan, SIGNAL("triggered()"), self.pan)
self.toolbar = self.addToolBar("Canvas actions")
self.toolbar.addAction(actionZoomIn)
self.toolbar.addAction(actionZoomOut)
self.toolbar.addAction(actionPan)
# create the map tools
self.toolPan = QgsMapToolPan(self.canvas)
self.toolPan.setAction(actionPan)
self.toolZoomIn = QgsMapToolZoom(self.canvas, False) # false = in
self.toolZoomIn.setAction(actionZoomIn)
self.toolZoomOut = QgsMapToolZoom(self.canvas, True) # true = out
self.toolZoomOut.setAction(actionZoomOut)
self.pan()
def zoomIn(self):
self.canvas.setMapTool(self.toolZoomIn)
def zoomOut(self):
self.canvas.setMapTool(self.toolZoomOut)
def pan(self):
self.canvas.setMapTool(self.toolPan)
Then from the Python script console run:
import mywnd
w1 = mywnd.MyWnd("MyLayername1")
w1.show()
w2 = mywnd.MyWnd("MyLayername2")
w2.show()
#etc......
If you make changes to the mywnd.py you can reload it with:
reload(mywnd)