Automated Data Processing with PyQGIS
0.0 (0 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.
1 student enrolled
Wishlisted Wishlist

Please confirm that you want to add Automated Data Processing with PyQGIS to your Wishlist.

Add to Wishlist

Automated Data Processing with PyQGIS

Over 75 recipes for automated data processing with PyQGIS
0.0 (0 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.
1 student enrolled
Created by Packt Publishing
Last updated 6/2017
Current price: $10 Original price: $125 Discount: 92% off
5 hours left at this price!
30-Day Money-Back Guarantee
  • 3.5 hours on-demand video
  • 1 Supplemental Resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Use Python and QGIS to produce captivating GIS visualizations and build complex map layouts
  • Find out how to effectively use poorly-documented and undocumented features of the QGIS Python API
  • Change QGIS settings programmatically to control default behaviors
View Curriculum
  • This course is for geospatial analysts or programmers at any experience level who would like to learn more about controlling QGIS using Python. A basic knowledge of Python is essential and some experience with QGIS is helpful but not required.
  • Software required : QGIS 2.18, Python 2.7.6 (should be included with QGIS itself), IBM Java 8 JDK, IBM Eclipse Neon 4.6.0 or higher, Eclipse PyDev 5.5.0, Google Earth or higher

QGIS is a desktop geographic information system that facilitates data viewing, editing, and analysis. QGIS, paired with the most efficient scripting language, Python, enables us to write effective scripts that extend the core functionality of QGIS. Based on version QGIS 2.18, this book will teach you how to write Python code that works with spatial data to automate geo-processing tasks in QGIS. It covers topics such as querying and editing vector data and using raster data. You will also learn to create, edit, and optimize a vector layer for faster queries, re-project a vector layer, reduce the number of vertices in a vector layer without losing critical data, and convert a raster to a vector. 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, and the Chief Information Officer (CIO) for , 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 course is for geospatial analysts who want to learn more about automating everyday GIS tasks as well as programmers responsible for building GIS applications. Its short, reusable recipes make concepts easy to understand and combine so you can build larger applications that are easy to maintain.
Compare to Other PyQGIS Courses
Curriculum For This Course
58 Lectures
Automating QGIS
12 Lectures 57:23

This video gives an overview of the entire course.

Preview 06:30

QGIS needs to be installed properly for working on it. This video will help you do that. 

Installing QGIS 2.18 for Development

The Python console is an interactive platform used for automation.

Using the QGIS Python Console for Interactive Control

In order to have the Python console always available, we will go through this video. 

Automatically Starting the Python Console

The QGIS Python Script Runner plugin provides a middle ground for QGIS automation between the interactive console and the overhead of plugins.

Using the Python's Script Runner Plugin

QGIS IDE has advanced debugging tools and is very useful. 

Setting Up Your QGIS IDE

Debugging programs that have processes in the foreground and background can be extremely difficult. This interactive debugging approach of QGIS makes the development of complex applications efficient.

Debugging QGIS Python Scripts

PyQGIS allows you to control virtually every aspect of QGIS. This video helps you to do that.

Navigating the PyQGIS API

Plugins are the best way to extend QGIS, as they can be easily updated and reused by other people. We will create a plugin in this video.

Creating a Traditional QGIS Plugin

The QGIS Processing Toolbox provides a powerful set of algorithms for QGIS Python Programming. Creating a plugin will help in easing the process. 

Creating a Processing Toolbox Plugin

PyQGIS allows you to store application-level preferences and retrieve them. QGIS also has project-level preferences, which can override the application-level preferences in some cases. We will learn how to work with them in this video. 

Storing and Reading Global and Project Preferences

Sometimes, you need to know exactly where the current working directory is so that you can access external resources. Accessing the script will enable that.

Accessing the Script Path from Within Your Script
Querying Vector Data
12 Lectures 40:26

Vector data stored in a local file is one of the most common geospatial data formats. We need to learn how to load the vector sample from a file.

Preview 04:07

The geodatabase provides powerful geospatial data management and operations. Hence it is important to learn about how to load a layer from a geodatabase.

Loading a Vector Layer from a Geodatabase

Once a vector layer is loaded, you may want to investigate the data. A true GIS layer contains both spatial geometry and non-spatial attributes. So we are going to examine vector layer attributes and features in this video.

Examining Vector Layer Features and Attributes

In this video, we'll perform a spatial operation to select the subset of a point layer based on the points contained in an overlapping polygon layer. 

Filtering a Layer by Geometry

In addition to the spatial queries outlined previously, we can also subset a layer by its attributes. You will do that in this video.

Filtering a Layer by Attributes

Buffering a feature creates a polygon around a feature as a selection geometry or just a simple visualization. 

Buffering a Feature

In the QgsDistanceArea object, PyQGIS has excellent capabilities for measuring the distance. We'll use this object measuring the distance between two points and along a line with multiple vertices.

Measuring the Distance between Two Points and Along a Line

Area calculation can be an end in itself to measure the size of a plot of land or a building. It can also be the input to other calculations such as land use maps. This video measures the area of a polygon.

Calculating the Area of a Polygon

A spatial index optimizes a layer for spatial queries by creating additional simpler geometries that can be used to narrow down the field of possibilities within the complex geometry. So let’s use that instead of geometry. 

Creating a Spatial Index

Sometimes, you need to know the compass bearing of a line to create specialized symbology or to use as input in a spatial calculation. In this video, we'll calculate the bearing of the end points of a line. 

Calculating the Bearing of a Line

Spreadsheets are one of the most common methods used to collect and store simple geographic data. So, it is very important to know how to load data from a spreadsheet.

Loading Data from a Spreadsheet

Metadata is an important tool for GIS analysts to understand a dataset. In this video, you'll extract the layer capabilities from a layer.

Accessing Layer Metadata
Editing Vector Data
14 Lectures 46:05

Sometimes you need to create a temporary dataset for a quick output, or as an intermediate step in a more complex operation without the overhead of actually writing a file to disk. You will learn just that in this video. 

Preview 02:58

The simplest editing that can be done to a vector is adding a point feature. You will learn that in this video.

Adding a Point Feature to a Vector Layer

Previously we added a point feature to a vector layer. Taking this a step further, adding a line feature is adding more points.

Adding a Line Feature to a Vector Layer

A polygon is the most complex kind of geometry; however, in QGIS the API is very similar to a line. When you add a new attribute, the attribute value for all existing features are set to NULL for that field index. We will add polygon, field and other attributes. 

Adding a Polygon Feature, Field, and Other Attributes to a Vector Layer

Joining attribute tables to other database tables allows you to use a spatial data set to reference a dataset without any geometry, using a common key between the data tables. Hence we will learn to do that in this video.

Joining a shapefile Attribute Table to a CSV File

To change the location and attribute of a feature PyQGIS provides a simple way. Learning that is important

Changing the Vector Layer Geometry and Feature’s Attribute

In this video we will remove features, attributes with features and reproject a vector layer using the Processign toolbox.

Removing Data from a Vector Layer, Deleting, and Re-projecting a Vector Layer

Files in the KML or GeoJSON format are better to work with than shapefiles. Therefore, it is a good practice to convert them to these file formats.

Converting a Shapefile to KML or GeoJSON

Merging datafiles with similar attributes and features leads to efficient use of memory. Alao sometimes it is necessary to split large datasets for ease of operation. Thus we will learn merging and splitting in this video.

Merging and Splitting Shapefiles

Generalization removes points from vector layer and reduces space. 

Generalizing a Vector Layer

Dissolving helps in creating a single layer with common attributes. 

Dissolving Vector Features

A union combines two overlapping vector shapes into one. 

Performing a Union on Vector Shapes

A raster dataset is sometimes more efficient way of displaying data in the backdrop. 

Rasterizing a Vector Layer

The GeoPackage format has the properties of both the file format and a geodatabase. It overcomes all the limitations of the shapefile format, such as file size limits, attribute name length limits, and many other inconveniences. Thus, we can use it in our videos. 

Exporting a Layer to the GeoPackage Format
Using Raster Data
20 Lectures 01:12:17

To use QGSRasterLayer API, we need to load a layer into QGIS. In this way we can work on the layer without adding it to the map. 

Preview 04:56

NetCDF stands for Network Common Data Form and is an open geospatial and scientific data format. Features of the format include machine-independent data storage, the ability to store vector, raster, and statistical data, as well as multi-dimensional data, and widespread software read and write support.

Loading a NetCDF File

The first key element of a geospatial raster is the width and height in pixels. The second key element is the ground distance of each pixel, also called the pixel size. We need to find both these values to work with a raster.

Getting the Cell Size, Width and Height of a Raster Layer

Bands represent layers of information within a raster. Hence it is important to count them and also sometimes necessary to swap them to recombine bands to change RGB values. 

Counting and Swapping Raster Bands

A common remote sensing operation is to get a raster value at a specified co-ordinate. In this video, we will calculate that.

Querying the Value of a Raster at a Specified Point

You can change the map projection of data to allow different layers to be displayed on the same map. Reprojection is required for that.

Reprojecting a Raster

A hillshade, or shaded relief, is a technique to visualize elevation data in order to make it Photo-realistic for presentation as a map. In this video, we will create an elevation hillshade.

Creating an Elevation hillshade

Contours provide an effective visualization of terrain data by tracing isolines along the same elevation to form a loop at set intervals in the dataset. So we will use the elevation data to create contours.

Creating vector contours from Elevation Data

Sometimes, you need to sample a raster dataset at regular intervals in order to provide summary statistics or for quality assurance purposes on the raster data. A common way to accomplish this regular sampling is to create a point grid over the dataset, query the grid at each point, and assign the results as attributes to those points.

Sampling a Raster Dataset Using a Regular Grid

If you have a transportation route through some terrain, it is useful to know the elevation profile of that route. This operation is accomplished in this video. 

Adding Elevation Data to a Line Vertices Using a Digital Elevation Model

If you are trying to compare two raster images, it is important that they have the same extent and resolution. We are going to create a common extent for rasters in this video. 

Creating a Common Extent for Rasters

Resampling an image allows you to change the current resolution of an image to a different resolution.

Resampling raster Resolution

The ability to run statistical algorithms on a dataset is the key to remote sensing. Mosaicking rasters is the process of fusing multiple geospatial images with the same resolution and map projection into one raster. In this video, we will count the number of unique combinations of pixels across multiple bands. And combine two overlapping images into a single dataset.

Counting the Unique Values in a Raster and Mosaicking Rasters

Image format conversion is a part of nearly every geospatial project. Hence it is important to learn how to do it. 

Converting a TIFF Image to a JPEG Image

Pyramids, or overview images, sacrifice the disk space for map rendering speed by storing resampled, lower-resolution versions of images in the file alongside the full-resolution image. Thus it is essential to know how to create a pyramid. 

Creating Pyramids for a raster

The ability to view rasters in a geospatial context relies on the conversion of pixel locations to coordinates on the ground. Similarly, when you receive a map coordinate as user input or from some other source, you must be able to convert it back to the appropriate pixel location on a raster. This video will enable you to do both things.

Converting a Pixel Location to a Map Coordinate and Vice Versa

The XML data format used by Google Earth for geospatial data is called KML. Converting rasters into a KML overlay compressed in a KMZ archive file is a very popular way to make data available to end users who know how to use Google Earth.

Creating a KML Image Overlay for a Raster

Raster datasets represent real-world features efficiently, but can have limited usage for geospatial analysis. Once you have classified an image into a manageable data set, you can convert those raster classes into a vector data set.

Converting a Raster to a Vector

Sometimes, a raster that represents features on the earth is just an image with no georeferencing information. Each change to an image holds the possibility of losing data, so georeferencing an image on demand is often the best approach.

Georeferencing a Raster from Control Points

Sometimes, you need to use a subset of an image which covers an area of interest for a project. Clipping a raster to a vector boundary allows you to only use the portions of the raster you need.

Clipping a Raster Using a Shapefile
About the Instructor
Packt Publishing
3.9 Average rating
8,229 Reviews
58,948 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.