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 segment to show the range of steepness. We'll overlay this layer on a hillshade of the DEM for a nice visualization. To do this, we need to perform the following steps:
- First, we need to import the QGIS processing module, the QGIS...