Building Mapping Applications with QGIS
eBook - ePub

Building Mapping Applications with QGIS

  1. 264 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Building Mapping Applications with QGIS

About this book

QGIS is one of the premiere open source Geographical Information Systems. While developing Python geospatial applications can be challenging, QGIS simplifies the process by combining the necessary geoprocessing libraries with a sophisticated user interface, all of which can be directly controlled using Python code.

Starting with an introduction to QGIS and how to use the built-in QGIS Python Console, we will teach you how to write Python code that makes use of the geospatial capabilities of QGIS. Building on this, you will ultimately learn how to create your own sophisticated standalone mapping applications built on top of QGIS. You will learn how to use the Python Console as a window into the QGIS programming environment, and then use that environment to create your own Python scripts and plugins to customize QGIS. As your knowledge of the PyQGIS library grows, you will use it to perform a variety of real-world geospatial programming tasks, culminating in the creation of your own complex standalone applications to load, analyze, and display geospatial data.

Trusted by 375,005 students

Access to over 1 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

Building Mapping Applications with QGIS


Table of Contents

Building Mapping Applications with QGIS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Getting Started with QGIS
About QGIS
Installing and running QGIS
Understanding QGIS concepts
Linking QGIS and Python
Exploring the Python Console
Examining a Python plugin
Writing an external application
Summary
2. The QGIS Python Console
Using the console
Working with geospatial data in the console
Scripting the QGIS user interface
The status bar
The message bar
Progress indicators
QGIS logging
Custom dialogs and windows
Summary
3. Learning the QGIS Python API
About the QGIS Python APIs
Deciphering the C++ documentation
Organizing the QGIS Python libraries
The qgis.core package
Maps and map layers
Coordinate reference systems
Vector layers
Displaying vector data
Accessing vector data
Spatial indexes
Raster layers
How raster data is displayed
Accessing raster data
Other useful qgis.core classes
The qgis.gui package
The QgisInterface class
The QgsMapCanvas class
The QgsMapCanvasItem class
The QgsMapTool class
Other useful qgis.gui classes
Using the PyQGIS library
Analyzing raster data
Manipulating vector data and saving it to a shapefile
Using different symbols for different features within a map
Calculating the distance between two user-defined points
Summary
4. Creating QGIS Plugins
Getting ready
Understanding the QGIS plugin architecture
Creating a simple plugin
The plugin development process
Using the Plugin Builder
Automating the build process
Plugin help files
Unit testing
Distributing your plugin
Writing a useful plugin
Possibilities and limitations of plugins
Summary
5. Using QGIS in an External Application
Introducing Lex
Getting the data
Designing the application
Creating the application's framework
Adding the user interface
Connecting the actions
Creating the map canvas
Labeling the points
Filtering the landmarks
Implementing the zoom tool
Implementing the pan tool
Implementing the explore mode
Further improvements and enhancements
Summary
6. Mastering the QGIS Python API
Working with symbol layers
Combining symbol layers
Implementing symbol layers in Python
Implementing renderers in Python
Working with custom map layers
Creating custom map canvas items
Using memory-based layers
Summary
7. Selecting and Editing Features in a PyQGIS Application
Working with selections
Using the layer editing mode
Adding Points
Editing Points
Deleting Points and other features
Adding lines and polygons
Editing lines and polygons
Summary
8. Building a Complete Mapping Application using Python and QGIS
Introducing ForestTrails
Designing the ForestTrails application
Creating the application
Laying out the application
Defining the toolbar icons
The constants.py module
The forestTrails.py module
The mapTools.py module
The ui_mainWindow.py module
Running the application
Obtaining the basemap
Defining the map layers
Defining the map renderers
The Pan Tool
Implementing the track editing mode
Summary
9. Completing the ForestTrails Application
The Add Track map tool
Testing the application
Vertex snapping
The Edit Track map tool
The Delete Track map tool
The Get Info map tool
The Set Start Point and Set End Point actions
The Find Shortest Path action
Adjusting the toolbar actions
Suggested improvements
Summary
Index

Building Mapping Applications with QGIS

Copyright © 2014 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2014
Production reference: 1231214
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-466-4
www.packtpub.com

Credits

Author
Erik Westra
Reviewers
David McDermott
Pablo Pardo
Heegu Park
Christopher Wesson
Commissioning Editor
Pramila Balan
Acquisition Editor
Sonali Vernekar
Content Development Editor
Rikshith Shetty
Technical Editor
Shruti Rawool
Copy Editors
Alfida Paiva
Vikrant Phadkay
Project Coordinator
Kinjal Bari
Proofreaders
Cathy Cumberlidge
Ameesha Green
Sonia Sanghera
Indexer
Monica Ajmera Mehta
Production Coordinator
Conidon Miranda
Cover Work
Conidon Miranda

About the Author

Erik Westra has been a professional software developer for over 25 years, and has worked almost exclusively with Python for the past decade. Erik's early interest in graphical user interface design led to the development of one of the most advanced urgent courier dispatch systems used by messenger and courier companies worldwide. In recent years, he has been involved in the design and implementation of systems that match seekers and providers of goods and services across a range of geographical areas. This work has included the creation of real-time geocoders and map-based views of constantly changing data. He is based in New Zealand, and works for companies worldwide.
He is the author of Python Geospatial Development, Packt Publishing.

About the Reviewers

David McDermott (MPhys Geog PGCE (Cantab)) is a proud Yorkshireman who has a keen interest in science fiction and Rugby League, as well as in GIS.
He studied at the University of Hull, where he acquired a 2:1 master's degr...

Table of contents

  1. Building Mapping Applications with QGIS

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Building Mapping Applications with QGIS by Erik Westra in PDF and/or ePUB format, as well as other popular books in Computer Science & Desktop Applications. We have over one million books available in our catalogue for you to explore.