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
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with QGIS
Index

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):
        self.mapCanvas.zoomIn()

    def zoomOut(self):
        self.mapCanvas.zoomOut()

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.