Automated GIS Workflows with PyQGIS
3.1 (4 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
65 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Automated GIS Workflows with PyQGIS to your Wishlist.

Add to Wishlist

Automated GIS Workflows with PyQGIS

Over 90 recipes for automated GIS Workflows with PyQGIS
3.1 (4 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
65 students enrolled
Created by Packt Publishing
Last updated 6/2017
Current price: $12 Original price: $125 Discount: 90% off
3 days left at this price!
30-Day Money-Back Guarantee
  • 3 hours on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion

Training 5 or more people?

Get your team access to Udemy's top 2,000 courses anytime, anywhere.

Try Udemy for Business
What Will I Learn?
  • Create dynamic maps to control QGIS
  • Access external web services
  • Create interactive input widgets for scripts
  • Create printed maps
  • Control QGIS GUI elements
  • Automatically generate PDF map books
  • Build dynamic forms for field input
  • Create, import, and edit geospatial data on disk or in-memory
View Curriculum
  • This video follows a recipe-based problem-solution approach to address and dispel challenges faced when implementing and using QGIS on a regular basis. The short, reusable recipes make concepts easy to understand and combine so you can build larger applications that are easy to maintain.

QGIS is a desktop geographic information system that facilitates data viewing, editing, and analysis. Paired with the most efficient scripting language—Python, we can write effective scripts that extend the core functionality of QGIS.

Based on version QGIS 2.18, this video will teach you how to write Python code that works with spatial data to automate geoprocessing tasks in QGIS. It will cover topics such as Creating Dynamic Maps.

You will also learn to compose static maps, interact with users.

Following this, you will work through recipes that will help you compose static maps, create heavily customized maps, and add specialized labels and annotations. As well as this, we’ll also share a few tips and tricks based on different aspects of QGIS.

About the Author

Joel Lawhead is a PMI-certified Project Management Professional (PMP), a certified Geographic Information Systems Professional, an award-winning firm specializing in geospatial technology integration and harsh-environment engineering. Joel builds geospatial systems for US government agencies, including NASA, NOAA, the US Department of Homeland Security, and the military. He also works with private organizations, including the National Oceans and Applications Research Center (NOARC) and The Ocean Cleanup. He has authored other books with Packt Publishing, including Learning Geospatial Analysis with Python, QGIS Python Programming Cookbook, and Learning Geospatial Analysis with Python, Second Edition. His cookbook recipes have been featured in two editions of the O’Reilly Python Cookbook.

Joel began using Python in 1997 and combined it with geospatial software development in 2000. He is also the developer of the widely used open source Python Shapefile Library (PyShp) and maintains the geospatial technical blog and Twitter feed, @SpatialPython, discussing the use of Python 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 compression algorithm, allowing developers around the world to create better integrated and more robust geospatial applications involving shapefiles.

In 2002, Joel 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.

Who is the target audience?
  • This video is for geospatial analysts who want to learn more about automating everyday GIS tasks as well as programmers responsible for building GIS applications.
Compare to Other GIS Courses
Curriculum For This Course
77 Lectures
Creating Dynamic Maps
16 Lectures 31:41

This video gives overview of the entire course.

Preview 04:37

Maps in QGIS are controlled through the map canvas. So in this video, we'll be accessing the canvas and then will be checking one of its properties to ensure that we have control over the object.

Accessing the Map Canvas

Changing map units, is a very common operation, depending on the purpose of your map. In this video, we'll be reading the map units used by QGIS and then change them for our project.

Changing the Map Units

For many GIS operations, you need to loop through the map layers to look for specific information or to apply a change to all the layers.In this video, we'll be looping through the layers and get information about them.

Iterating Over Layers

The symbols describe properties, including color, shape, size, and line width. In this video, we’ll be loading a vector layer, change its symbology, and finally refresh the map.

Symbolizing a Vector Layer

In this video, we will load a polygon layer onto the map, and then interactively change it to just an outline of the polygon.

Setting a Transparent Layer Fill

Filled marker symbols allow for an endless set of options for rendering a polygon. In this video, we'll do a very simple filled marker symbol that paints a polygon with stars.

Using a Filled Marker Symbol

A color ramp allows you to render a raster using just a few colors to represent different ranges of cell values that have a similar meaning in order to group them. The approach that will be used in this video is the most common way to render elevation data.

Rendering a Single Band Raster Using a Color Ramp Algorithm

In this video, we'll load some points into QGIS from a CSV file and use one of the columns to determine the color of each point. 

Setting a Feature's Color Using a Column in a CSV File

The true power of QGIS symbology lies in its ability to stack multiple symbols in order to create a single complex symbol. In this video, we'll merge two symbols to create a single symbol and begin unlocking the potential of complex symbols.

Creating a Complex Vector Layer Symbol

TrueType fonts are scalable vector graphics that can be used as point markers. In this video, we'll create a symbol of this type.

Using Icons as Vector Layer Symbols

Font markers open up broad possibilities for icons, but a single-color shape can be hard to see across a varied map background. In this video, we'll use font marker symbol methods to place an outline around the symbol to give it contrast and, therefore, visibility on any type of background.

Using an Outline for Font Markers

Sometimes you also need to convey a direction along a line. In this video, we'll symbolize some line features showing historical human migration routes around the world.

Using Arrow Symbols

Graduated vector layer symbol renderer is the vector equivalent of a raster color ramp. In this video, we'll render a graduated symbol using a polygon shapefile.

Creating a Graduated Vector Layer Symbol Renderer

A categorized vector layer symbol allows you to create distinct categories with colors and labels for unique features. In this video, we'll categorize a vector layer into three different categories.

Creating a Categorized Vector Layer Symbol

Live layer effects provide advanced cartographic effects for QGIS maps. In this video, we'll add the inner glow and drop shadow live layer effects to a polygon layer.

Using Live Layer Effects
Working with Dynamic Maps
11 Lectures 22:02

Shapeburst fills are a type of symbol layer that allow you to create buffered gradient fills. In this video, We'll use a land shapefile and a water shapefile, and in the water feature, we'll color it to give the illusion of deeper water in the middle.

Preview 02:19

Map bookmarks allow you to save a location on a map in QGIS, so you can quickly jump to the points you need to view repeatedly without manually panning and zooming the map.

Creating a Map Bookmark

Map bookmarks store important locations on a map, so you can quickly find them later.

Navigating to a Map Bookmark

PyQGIS supports scale-based visibility to programmatically set the scale range, in which a layer is displayed. In this video, we'll investigate scale-dependent layers.

Setting Scale-Based Visibility for a layer

Scalable Vector Graphics (SVG) are an XML standard that defines vector graphics which can be scaled at any resolution. In this video, we'll use Python to apply one of the SVG symbols included with QGIS to a point layer.

Using SVG for Layer Symbols

QGIS has the ability to use dynamic pie charts as symbols describing the statistics in a given region. In this video, we'll use pie chart symbols on a polygon layer in QGIS.

Using Pie Charts for Symbols

The 2.5D renderer is a powerful new visualization for QGIS, which allows you to present buildings as three-dimensional shapes from a single angle. In this video, we'll render a small set of building footprints in 2.5D, with height values set as a shapefile attribute.

Using the 2.5D Renderer

A tiled map service allows you to efficiently display large raster data sets from web services. Also There are two types of Esri services: ArcGIS map services, which provide tiled map layers, and ArcGIS feature services, which provide vector layers. So in this video, we'll load the Open Street Map tiled map service and create a map with one of each type of Esri service.

Using XYZ Tiled and Esri ArcGIS Map Services

Once your map layers are styled, the next step to creating a complete map is labeling features. We'll explore the basics of labeling in this video.

Labeling a Feature

Null symbols are a tool that allow you to have a layer without any symbology In this video, we'll load a point layer and label it, but use null symbology.

Using Null Symbols

Map layer transparency allows you to change the opacity of a layer, so the items behind it are visible to some degree.

Change Map Layer Transparency
Composing Static Map
9 Lectures 28:23

In order to turn a dynamic GIS map into a static map image or document, you must create a renderer to freeze the map view and create a graphic version of it. In this video, we'll render a map to a JPEG image and save it.

Preview 03:12

The QGIS Map Composer allows you to combine a map with non-spatial elements that enhance the understanding of the map. In this video, we'll be creating a basic map composition.

Using the Map Composer

The Q g s Composition object allows you to place arbitrary text anywhere in the composition. In this video, we'll demonstrate how to add a label to a map composition.

Adding Labels to a Map for Printing

In this video, we'll create a scale bar that increments in kilometers then we will be adding an arrow element that points to the north and finally we'll add a simple logo to the map.

Adding a Scale Bar, North Arrow and Logo to a Map

A map legend decodes the symbology used in a thematic GIS map for the reader. Legends are tightly integrated into QGIS, and in this video, we'll add the default legend from the map to the print composition and we'll add two layers set up the legend to run horizontally across the top of the map.

Adding a Vertical and a Horizontal Legend to the Map

The QGIS composer has an object for drawing and styling nonspatial shapes, including rectangles, ellipses, and triangles. In this video, we'll add some rectangles filled with different colors, which resemble a simple bar chart; then we will add grid for reference purpose. And finally add the table to the composition.

Adding a Custom Shape, Grid, and Table to the Map

Exporting a map as an image removes all of its spatial information. However, you can create an external text file, called a world file, which provides the georeferencing information. In this Video, we'll export a map composition as an image and create a world file along with it.

Adding a World File to a Map Image

Saving a project automatically can be useful for auto save features. In this video, we'll save a QGIS project to a .qgs project file. 

Saving a Map to a Project

Loading a project will set up the map and project settings for a previously saved project within QGIS.This video demonstrates you to load a project from a .qgs XML file. 

Loading a Map from a Project
Interacting with the User
10 Lectures 27:19

Log files provide a way of tracking exactly what is going on in a Python plugin or script. These log messages make troubleshooting easier. In this video, we'll demonstrate two methods used for logging. actual log files and QGIS Log Messages Panel

Preview 03:15

In this video, we'll create a simple information dialog, a warning dialog to notify a user when an issue is detected, and an example of error dialog.

Creating a Simple Message, Warning and Error Dialog

A progress bar is a dynamic dialog that displays the percentage of completion bar for a running process that the user must wait for before continuing. In this video, we'll create a simple progress dialog based on a timer.

Displaying a Progress Bar

In this video, we demonstrate one of the simplest methods used for accepting input from a user: a text input dialog. And then we'll create a file dialog and print the chosen filename to the console.

Creating a Simple Text Input and a File Input Dialog

In this video we'll create a simple combobox, then we will proceed to create radio buttons then we'll create a dialog with checkboxes and some textboxes.

Creating a Combobox, Radio Buttons, Checkboxes, and a Dock Widget

The status bar in QGIS displays a variety of information in all sorts of contexts. In this video, we'll print the current time to the status bar.

Displaying a Message in the Status Bar

In this video we'll push a simple message to the status bar and then we'll display a progress bar in the message bar. 

Pushing Messages and Widgets to the Message Bar

Tabs provide titles at the top of the window, which present an individual widget layout for each title when clicked. In this video, we'll create a simple tabbed interface. 

Creating Tabs

Wizard is a series of dialogs that lead the user through a sequence of steps. In this video, we'll create a simple three-page wizard to collect some information from the user and display it back to them. 

Stepping the User Through a Wizard

Qt has a window setting called hint, which allows you to force a window to stay on top. This type of dialog is called a modal dialog. In this video, we'll create a message dialog using hint.

Keeping Dialogs on Top
QGIS Workflows
14 Lectures 40:46

NDVI is used to detect green vegetation in an area of interest. So here in this video, we will use Python to control the QGIS raster calculator in order to create an NDVI using a multispectral image of a farm field.

Preview 04:19

Geocoding is the process of turning an address into earth coordinates. In this video, we'll use this plugin to programmatically geocode an address. 

Geocoding Addresses

The vector footprint files can be easily loaded in QGIS or served over the Web. This video demonstrates a method to create a footprint vector from a directory full of raster files.

Creating Raster Footprints

Network analysis allows you to find the most efficient route between two points along a defined network of connected lines. In this video, we'll use a generic line network to perform analysis using the Dijkstra algorithm, to find the shortest path. 

Performing Network Analysis

Street routing has now become so commonplace that we take it for granted. So here in this video we will perform routing operations in QGIS, we'll use the QGIS GeoSearch plugin.

Routing Along Streets

QGIS has the ability to connect to a GPS .In this video, we'll use the QGIS API to process NMEA sentences and update a point on a global map.

Tracking a GPS

Nearest neighbor analysis relates one point to the nearest point in one or more datasets. In this video, we'll relate one set of points to the closest point from another dataset.

Performing Nearest Neighbor Analysis

In this video, we will we'll convert a LAS point cloud file to a Digital Elevation Model (DEM). We’ll use earthquake point data to create a heat map of the impact of an earthquake and illustrate population density in some US census bureau tracts.

Creating a DEM from LIDAR and Dot Density Map

Collecting field observation data from the field into a GIS required hours of manual data entry. n this video, we'll use a simple GeoJSON-based framework to enter information and a map location from any Internet-connected device with a web browser to update a map in QGIS.

Collecting Field Data

A common geospatial workflow is to assign raster values to a coincident vector layer. This video will use this concept to illustrate the steepness of a road using color by mapping values to the road vector from a slope raster.

Computing Road Slope Using Elevation Data

In this video, we'll use EXIF tags to create locations on a map for some photos and provide links to open them.

Geolocating Photos on the Map

In this video, we'll do a simple difference change detection on two images, which are several years apart, to see the differences in urban development and the natural environment.

Image Change Detection

A common task in digitizing is to outline buildings in an image to make footprints for urban analysis. In this video we'll automatically transform some non-rectangular polygons into rectangles using a simple algorithm.

Adjusting Imprecise Building Footprints

In this video, we'll load a dataset that has multiple time steps, and use the well-designed TimeManager plugin to step through the data time steps in an animation.

Visualizing Multi-Temporal Data
Other Tips and Tricks
17 Lectures 41:21

In this video we are going to create Internet web map tiles from our QGIS map.

Preview 04:04

In this video demonstrates to use a service named, which serves vector layers online which you can upload from QGIS using Python.

Adding a Layer to

This video demonstrates how to use a rule-based renderer to color code a layer based on an attribute. 

Rendering Map Layers Based on Rules

Layer styling is one of the most complex aspects of the QGIS Python API. Once you've developed the style for a layer, it is often useful to save the styling to the QGIS Markup Language (QML) XML format.

Creating a Layer-Definition File

Python uses None objects of type None instead of NULL values. In this video, we'll explore the implications of QGIS NULL values in Python. 

Using NULL Values in PyQGIS

A simple Python QGIS query engine, uses generators to make fetching features from QGIS layers easier. We'll use this engine in this video, to query a layer.

Using Generators for Layer Queries

Thematic maps often use a color ramp based on a single color to show data density. In this video, you use some bear-sighting data to show concentrations of bears over an area.

Using Alpha Values to Show Data Density

The geo_interface is a newer protocol to provide a string representation of geographical data. In this video we will use this to to provide a code snippet, which you can put at the beginning of your Python scripts to retrofit QGIS feature.

Using the __geo_interface__ protocol

The processing framework is mostly very consistent, however the names of output variables vary. So in this video, we'll use PyQGIS to programmatically get the output variable name.

Getting the Output File Names from Processing Algorithms

You can generate points within a polygon fairly simply using a point in polygon method. In this video, we will demonstrate 2 methods to generate points along line.

Generating Points Along a Line

Expressions are a kind of mini-programming language or SQL-like language found throughout different QGIS functions. Here in this video, we will filter labels using expressions from within Python.

Using Expression-Based Labels

If you need to calculate the total of a given dataset property such as length, the easiest thing to do is just use Python. In this video, we'll total the length of all of the railways in a dataset.

Calculating Length for all Selected Lines

Sometimes, you want to display a different coordinate system for the mouse coordinates in the status bar. With this video, you can set a different coordinate system without changing the data.

Using a Different Status Bar CRS than the Map –

OpenStreetMap has an API called Overpass that lets you access OSM data dynamically. In this video, we'll add some OSM tourism points of interest to a map. 

Using OpenStreetMap Points of Interest in QGIS

QGIS displays data in a two dimensions even if the data is 3D. In this video, we'll use the Qgis2threejs plugin to display QGIS data in 3D in a browser.

Visualizing Data in 3D with WebGL and on a Globe

Since the release of Google Earth, spinning globe applications are a useful and popular method of geographical exploration. In this video, we'll display a layer in Google Earth.

Make a Globe-Like Azimuthal Orthographic Projection

QGIS increasingly supports cartographic visualizations that go beyond GIS analysis. In this video we'll animate hub lines generated from the nearest neighbor analysis of UFO sightings in major cities. 

Animating a Layer
About the Instructor
Packt Publishing
3.9 Average rating
8,274 Reviews
59,238 Students
687 Courses
Tech Knowledge in Motion

Packt has been committed to developer learning since 2004. A lot has changed in software since then - but Packt has remained responsive to these changes, continuing to look forward at the trends and tools defining the way we work and live. And how to put them to work.

With an extensive library of content - more than 4000 books and video courses -Packt's mission is to help developers stay relevant in a rapidly changing world. From new web frameworks and programming languages, to cutting edge data analytics, and DevOps, Packt takes software professionals in every field to what's important to them now.

From skills that will help you to develop and future proof your career to immediate solutions to every day tech challenges, Packt is a go-to resource to make you a better, smarter developer.

Packt Udemy courses continue this tradition, bringing you comprehensive yet concise video courses straight from the experts.