1

I want to calculate the slope of a forest road in mountainous areas.
No problem with ArcGIS following the instructions of the following post:

(see comment of user 'FelixIP')
How do I find the slope of road segments with point elevation data of the same linear path

Summary:
1.) split line (forest road) into equal lengths segments
2.) convert segments to 3D shapes (Interpolate shape tool)
3.) calculate slope of each segment with the field calculator ->

  abs( !Shape!.lastPoint.Z- !Shape!.firstPoint.Z)/ !Shape!.length*100

The output are slope values for every line segment of that polyline. In the attribute table, every segment has its individual slope value now.

This works with ArcGIS. Now I would like to do the same with QGIS.
I tried to use the point sampling tool, tried to rasterize the polyline, tried 'QChainage', the Topology checker and the pProf plugin but it didn't bring the expected results.

10

In the QGIS Processing Toolbox, there are GRASS tools v.split.length and v.drape (using QGIS 2.18.16).

Before starting;

0.) make sure your DEM and road data are projected onto the same CRS.

Then, following your summary workflow:

1.) split line (forest road) into equal lengths segments

v.split.length will give you a new layer Split by length by default.

2.) convert segments to 3D shapes (Interpolate shape tool)

v.drape will give you a new 3D vector layer.

3.) calculate slope of each segment with the field calculator

abs(z(start_point($geometry)) - z(end_point($geometry)))/$length*100

| improve this answer | |
  • First i struggeld with the v.drape tool. The tool did run but i wouldn't generate any outcome. I realized only then that the file path contained a 'ü' letter and thats why it didn't work. Thanks for your help everybody. – Quarantäne Mar 5 '18 at 10:31
5

This is a modification of Kazuhito's answer using native QGIS algorithms using QGIS 3.12.
In the QGIS Processing Toolbox, there are the tools Split lines by maximum length and Drape (set Z value from raster).

Before starting;

0.) make sure your DEM and road data are projected onto the same CRS.(This is no longer strictly necessary in QGIS 3.x using native algorithms but helpful to reduce unexpected issues. More importantly check that your elevation and distance are in the same units.)

Then, following your summary workflow:

1.) split line (forest road) into equal lengths segments

Split lines by maximum length will give you a new layer Split.

2.) convert segments to 3D shapes (Interpolate shape tool)

Drape (set Z value from raster) will give you a new 3D vector layer Updated.

3.) calculate slope of each segment with the field calculator

abs(z(start_point($geometry)) - z(end_point($geometry)))/$length*100 A breakdown of the formula:

abs = Absolute value to get rid of the negative numbers

z(start_point($geometry) = The elevation of the first vertex in your line

z(end_point($geometry) = The elevation of the last vertex in your line

$length = The length of your line

*100 = Makes it a percent

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.