Adding standard map tools to the canvas

In this recipe, you'll learn how to add standard map navigation tools to a standalone map canvas. Creating the simplest possible interactive application provides a framework to begin building specialized geospatial applications using QGIS as a library.

Getting ready

Download the following zipped shapefile and extract it to your qgis_data directory into a folder named ms from https://github.com/GeospatialPython/Learn/raw/master/Mississippi.zip.

How to do it...

We will walk you through the steps required to create a map canvas, add a layer to it, and then add some tools to zoom and pan the map, which are given as follows:

  1. First, because we are working outside the QGIS Python interpreter, we need to import some ...

Get QGIS Python Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.