Learn how to use Python to create dynamic maps in QGIS with this free preview chapter of QGIS Python Programming CookBook. With 140 short, reusable recipes to automate geospatial processes in QGIS, the QGIS Python Programming CookBook teaches readers how to use Python and QGIS to create and transform data, produce appealing GIS visualizations, and build complex map layouts. The book is written by Joel Lawed, the Chief Information Officer (CIO) of NVisionSolutions Inc. Lawed, who has been using Python since 1997, maintains the geospatial technical blog GeospatialPython.com and is also the author of Learning Geospatial Analysis with Python.
Creating Dynamic Maps: QGIS Python Programming CookBook
In this chapter, we’ll programmatically create dynamic maps by using Python to control every aspect of the QGIS map canvas. We’ll learn to use custom symbology, labels, map bookmarks and even real-time data. We’ll even go beyond the canvas to create custom map tools.You will begin to see that every aspect of QGIS is up for grabs with Python to write your own application. Sometimes the PyQGIS API may not directly support your application goal, but there is nearly always a way to accomplish what you set out to do with QGIS.
The Creating Dynamic Maps (Chapter 5 from QGIS Python Programming CookBook) covers:
- Accessing the Map Canvas
- Change the Map Units
- Iterating over Layers
- Symbolizing a Vector Layer
- Rendering a Single Band Raster Using a Color-Ramp Algorithm
- Creating a Complex Vector Layer Symbol
- Using Icons as Vector Layer Symbols
- Creating a Graduated Vector Layer Symbol
- Creating a Categorized Vector Layer Symbol
- Creating a Map Bookmark
- Navigating to a Map Bookmark
- Setting Scale-Based Visibility for a Layer
- Using SVG for Layer Symbols
- Using Pie Charts for Symbols
- Using the OpenStreetMap Service
- Using the Bing Aerial Image Service
- Adding Real-Time Weather Data from OpenWeatherMap
- Labeling a Feature
- Change Map Layer Transparency
- Adding Standard Map Tools to the Canvas
- A Map Tool to Draw Points on the Canvas
- A Map Tool to Draw Polygons or Lines, on the Canvas
- Building a Custom Selection Tool
- Creating a Mouse Coordinate Tracking Tool
QGIS Python Programming CookBook
By: Joel Lawed
Published: March 2015
Free weekly newsletter
Fill out your e-mail address to receive our newsletter!
By entering your email address you agree to receive our newsletter and agree with our privacy policy.
You may unsubscribe at any time.
About the author:
Joel Lawhead is a PMI-certified Project Management Professional (PMP) and the Chief Information Officer (CIO) of NVisionSolutions Inc., an award-winning firm that specializes in geospatial technology integration and sensor engineering. Joel began using Python in 1997 and began combining it with geospatial software development in 2000. He is the author of Learning Geospatial Analysis with Python, Packt Publishing. His Python cookbook recipes were featured in two editions of Python Cookbook, O’Reilly Media. He is also the developer of the widely used, open source Python Shapefile Library (PyShp) and maintains the geospatial technical blog GeospatialPython.com and the Twitter feed @SpatialPython, which discuss the use of the Python programming language within the geospatial industry. In 2011, Joel reverse engineered and published the undocumented shapefile spatial indexing format and assisted fellow geospatial Python developer, Marc Pfister, in reversing the algorithm used, allowing developers around the world to create better-integrated and more robust geospatial applications involving shapefiles. Joel served as the lead architect, project manager, and co-developer for geospatial applications used by US government agencies, including NASA, FEMA, NOAA, the US Navy, and many other commercial and non-profit organizations. In 2002, he received the international Esri Special Achievement in GIS award for his work on the Real-Time Emergency Action Coordination Tool (REACT), for emergency management using geospatial analysis.