[GIS] Get values of terrain elevation of roads in QGIS

demelevationqgisroadsaga

I have one DEM raster layer with elevation values and one vector layer of the roads; same size, extension and CRS.

I want to do what this guy did here:

http://youarealegend.blogspot.de/2012/07/computing-roads-slopes-with-qgis.html

But instead of using slope I want to use simple elevation.

I converted my raster into polygons and tried to intersect (Vector > Geoprocessing > Intersection) it with the roads layer, but apparently is too much for Qgis to calculate, since it keeps crashing even before 2% of the processing. I would like to know another approach for doing this?

What I need in the end it's a table/data.frame that relates the "lines"(roads) and the elevation. Because I will use this in glm model.

Best Answer

(I would suggest not to follow the approach in the linked blog post.)

You should be able to use more straightforward tool, Profiles from lines in QGIS Processing Toolbox | SAGA | Terrain Analysis - Profiles.

It will return new point vector layer with elevation values at each pixel along the designated line (road). Saving this attribute table into csv format will make it easy to handle the data in R for further analysis.

Related Question