Graphics Reference
In-Depth Information
self.endPointLayer)
layers.append(QgsMapCanvasLayer(self.endPointLayer))
This completes all five of our map layers. The final part of the setupMapLayers()
method adds these various layers to the map canvas. Note that because we defined the
map layers in back-to-front order (in other words, the first entry in layers is the
basemap, which should appear at the back), we have to reverse the layers before we add
them to the map canvas. Here is the relevant code:
layers.reverse()
self.mapCanvas.setLayerSet(layers)
self.mapCanvas.setExtent(self.baseLayer.extent())
The last thing we have to do is add a call to setupMapLayers() from within our
main() function. Add the following immediately after the win-
dow.setupDatabase() line:
window.setupMapLayers()
Now that our map layers are set up, we can run our program again. There's no vector data
yet, but the basemap should be visible, and we can zoom in and out using the toolbar
icons:
Search WWH ::




Custom Search