Reader small image

You're reading from  Learn QGIS - Fourth Edition

Product typeBook
Published inNov 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781788997423
Edition4th Edition
Languages
Tools
Right arrow
Authors (2):
Andrew Cutts
Andrew Cutts
author image
Andrew Cutts

Andrew Cutts holds a geography degree and a masters degree in GIS and has almost 20 years of experience in working with geospatial technology. He currently works as a freelance geospatial consultant. He has worked in local government, large multinational companies, and small and medium-sized enterprises. He has run a geospatial blog for almost 3 years and is a co-host of the #scenefromabove podcast. Andrew has spoken at events worldwide on GIS and Earth observation. He is a keen user of Python, especially for rapid prototyping for geospatial challenges. Currently, he is working with clients to maximize their investment with geospatial technology through direct consulting, training, and technical writing.
Read more about Andrew Cutts

Anita Graser
Anita Graser
author image
Anita Graser

Anita Graser is a spatial data scientist, open source GIS advocate, and author with a background in geographic information science. She is currently working with the Center for Mobility Systems at the Austrian Institute of Technology in Vienna and teaching QGIS classes at UNIGIS Salzburg. She serves on the QGIS project steering committee. and has published several books about QGIS. Furthermore, she develops tools, such as the Time Manager plugin for QGIS. You can follow her on Twitter @underdarkGIS.
Read more about Anita Graser

View More author details
Right arrow

Spatial Analysis

In this chapter, we will use QGIS to perform many typical spatial analysis tasks. We will start with raster processing, using tools such as clipping and terrain analysis. We will also cover the essentials of converting between raster and vector formats. We will then continue with common vector processing tasks, such as generating heatmaps and calculating area shares within a region. We use the new Processing toolbox as well as the modeler to begin to build automated processing workflows.

Topics covered in this chapter include the following:

  • Processing toolbox
  • Analyzing raster data
  • Converting between raster and vector
  • Raster and vector statistics
  • Heatmap from points
  • Advanced raster and vector processing
  • Batch processing
  • Graphical modeler

Processing toolbox

The processing toolbox in QGIS 3.4 is accessed from Processing | Toolbox. In this chapter, we will utilize many tools via the processing toolbox. This has a fast search feature, which is the easiest method for finding a tool. If you are familiar with older versions of QGIS, you will still find many of the tools in the locations or menus where they were previously available. Many plugins often become core functions in QGIS. If you cannot find the plugin, try searching the toolbox first.Alternatively you can also search for tools in the information toolbar.

Analyzing raster data

Raster data, including, but not limited to, elevation models or remote sensing imagery, is commonly used in many workflows. The following exercises show common raster processing and analysis tasks such as clipping to a certain extent, creating relief, slope rasters from digital elevation models, and using the raster calculator.

Clipping rasters

To begin the process of clipping rasters, load the SR_50M_alaska_nad.tif raster and the regions.shp (both from our sample data) as the layer to be clipped. Now zoom to the extent of the regions.shp and select one region using the selection tools. In this example, we will clip the raster to a selected layer within the polygon shapefile. From the main menu, select...

Combining raster and vector data

As discussed in Chapter 2, Data Creation and Editing, raster and vector data are the main sources of GIS data. These are often analyzed separately. However, more complex analyses sometimes require a combination of raster and vector data. We often need to convert raster data to vector data and vice versa. QGIS has this ability and uses GDAL calls (Polygonize and Rasterize) respectively. In the following exercises, we will use both raster and vector datasets to explain how to convert between these different data types. We will also look at how to access layer and zonal statistics, and finally, how to create a raster heatmap from point data.

Converting between rasters and vectors

Tools for converting...

Advanced vector and raster analysis with processing

In the following sections, we will cover more advanced processing tools and see how we can use the modeler to automate our tasks.

Finding nearest neighbors

Finding nearest neighbors – for example, the airport nearest to a populated place – is a common task in geoprocessing.

To do this, load the popp.shp into QGIS as well as the airports.shp, if this is not already loaded. Then search for the Distance to Nearest Hub tool (Line to Hub) in the toolbox. You should use the popp.shp as the Source points layer and the airports as the Destination hubs layer. The Hub layer name attribute will be added to the results attribute table to identify the nearest feature. Select...

Summary

In this chapter, we covered various raster and vector geoprocessing and analysis tools and looked at how to apply these in common tasks. We saw how to use the processing toolbox to run individual tools, as well as the modeler to create complex geoprocessing models from multiple tools. Using the modeler, we can automate our workflows and increase our productivity, especially with respect to recurring tasks.

In the final chapter of this book, we will look at how to extend QGIS further using Python and explore some of the new features in QGIS 3, including 3D visualization.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Learn QGIS - Fourth Edition
Published in: Nov 2018Publisher: PacktISBN-13: 9781788997423
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Andrew Cutts

Andrew Cutts holds a geography degree and a masters degree in GIS and has almost 20 years of experience in working with geospatial technology. He currently works as a freelance geospatial consultant. He has worked in local government, large multinational companies, and small and medium-sized enterprises. He has run a geospatial blog for almost 3 years and is a co-host of the #scenefromabove podcast. Andrew has spoken at events worldwide on GIS and Earth observation. He is a keen user of Python, especially for rapid prototyping for geospatial challenges. Currently, he is working with clients to maximize their investment with geospatial technology through direct consulting, training, and technical writing.
Read more about Andrew Cutts

author image
Anita Graser

Anita Graser is a spatial data scientist, open source GIS advocate, and author with a background in geographic information science. She is currently working with the Center for Mobility Systems at the Austrian Institute of Technology in Vienna and teaching QGIS classes at UNIGIS Salzburg. She serves on the QGIS project steering committee. and has published several books about QGIS. Furthermore, she develops tools, such as the Time Manager plugin for QGIS. You can follow her on Twitter @underdarkGIS.
Read more about Anita Graser