Book Image

Building Mapping Applications with QGIS

By : Erik Westra
Book Image

Building Mapping Applications with QGIS

By: Erik Westra

Overview of this book

Table of Contents (16 chapters)
Building Mapping Applications with QGIS
About the Author
About the Reviewers
Free Chapter
Getting Started with QGIS

Implementing the zoom tool

Next, we want to support zooming in and out. As mentioned earlier, one of the requirements for our Lex application is that it must work like Google Maps rather than QGIS, and this is an example of where we have to support this. QGIS has a zoom tool, which the user clicks on and then clicks or drags on the map to zoom in or out. In Lex, the user will click on the toolbar icons directly to do the zooming. Fortunately, this is easy to do; simply implement the zoomIn() and zoomOut() methods in the following way:

    def zoomIn(self):

    def zoomOut(self):

Now, try to run your program. As you zoom in and out, you can see the various landmarks appear and disappear, and you should also be able to see the different font sizes used for the labels based on each feature's SCALERANK value.