O'Reilly logo

QGIS Python Programming Cookbook by Joel Lawhead

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Computing road slope using elevation data

A common geospatial workflow is to assign raster values to a coincident vector layer so that you can style or perform further analysis on the vector layer. This recipe will use this concept to illustrate the steepness of a road using color by mapping values to the road vector from a slope raster.

Getting ready

You will need to download a zipped directory from https://geospatialpython.googlecode.com/svn/road.zip and place the directory, named road, in your qgis_data directory.

How to do it...

We'll start with a DEM and compute its slope. Then, we'll load a road vector layer and break it into interval lengths of 500 meters. Next, we'll load the layer and style it using green, yellow, and red values for each ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required