Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Building Mapping Applications with QGIS
  • Table Of Contents Toc
Building Mapping Applications with QGIS

Building Mapping Applications with QGIS

By : Erik Westra
4.6 (9)
close
close
Building Mapping Applications with QGIS

Building Mapping Applications with QGIS

4.6 (9)
By: Erik Westra

Overview of this book

If you are an experienced Python developer who wants to create your own geospatial applications with minimum fuss, this is the book for you. While some familiarity with mapping applications would be an advantage, no prior knowledge of geospatial concepts is required. Even if you've never used QGIS before, this book will quickly get you up to speed.
Table of Contents (11 chapters)
close
close
Lock Free Chapter
1
1. Getting Started with QGIS
10
Index

The Pan Tool


To let the user move around the map, we'll make use of the PanTool class we implemented in an earlier chapter. Add the following class definition to the mapTools.py module:

class PanTool(QgsMapTool):
    def __init__(self, mapCanvas):
        QgsMapTool.__init__(self, mapCanvas)
        self.setCursor(Qt.OpenHandCursor)
        self.dragging = False

    def canvasMoveEvent(self, event):
        if event.buttons() == Qt.LeftButton:
            self.dragging = True
            self.canvas().panAction(event)

    def canvasReleaseEvent(self, event):
        if event.button() == Qt.LeftButton and self.dragging:
            self.canvas().panActionEnd(event.pos())
            self.dragging = False

Back in our forestTrails.py module, add the following new method:

    def setupMapTools(self):
        self.panTool = PanTool(self.mapCanvas)
        self.panTool.setAction(self.actionPan)

This method will initialize the various map tools that our application will use; we'll add to this method...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Building Mapping Applications with QGIS
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon