Take the 2-minute tour ×

I've a shapefile of roads data. It contains information about terrain of road segments, i.e., hilly, flat, undulating, etc. I want to determine gradient of every road segment. I know this might require corresponding raster data and a lot of image processing. I also understand that I can use GRASS for this kind of analysis. But I've never attempted a task like this before.

For those who have, is GRASS my best bet? And, must I get the corresponding raster data? Is there a way I can do this without having to get my hands dirty with image processing algorithms. In case I must get the corresponding raster data, is there a source I can get reliable raster data that is not more than 4 years old?

Your contribution will be highly appreciated.

UPDATE: There will be a need to split a road segment that has both ascending and descending gradients. Overlaying the roads vector onto a raster layer is one of the options I think can work. But I don't have the raster data. Any idea where I can get raster data with sufficient accuracy and resolution will be appreciated. Can GRASS accomplish the splitting, and the analysis. I'd prefer open source tools for now as I'm still experimenting.

UPDATE: The purpose of the analysis is to come up with an algorithm that calculates economic well being of a point on a map, taking into account its accessibility (distance from the road, terrain, among other factors). Also, the algorithm is to also aid in decision making in relief food distribution.

UPDATE: I've got some material here on terrain analysis. Any advice is still welcome.

share|improve this question
What happens when a road segment spans both an uphill and downhill stretch? What would you want do in that scenario, average or split the road segment? The latter would be quite complicated. You also didn't specify where your study area is. –  nagytech Aug 31 '12 at 7:47
@Geoist, I've just got the problem definition. I'm trying to come up with an algorithm that would help determine economic state of a geographical area given its accessibility, among other factors. I also want to construct an algorithm that gives an efficient route to a point. The algorithm should not only consider distance, but also terrain (if the terrain is a hill, I would like to know its gradient). Other factors like whether the road is murram or tarmacked are also to be taken into account. –  okello Aug 31 '12 at 10:08

3 Answers 3

Heres what i would do:

  1. Overlay the roads layer with a dtm layer, this way, all the vertices of the segments would get a Z coordinate
  2. Calculate the gradient based on the segment length and height difference between the start and end point of the segment
  3. Classify the segments based on the gradient value as required

Tools i would use: FME

PS: When you say road segments, you probably think of them as segments in network topology, ie, one segment may be a polyline, not a simple line. Its up to you to decide wheter you want the gradient calculated for such a segment or perhaps for a single line

share|improve this answer
Thanks a lot, @U2ros. I was thinking of the same thing; I've to overlay the road layer onto a raster layer. There will be a need to split a segment that has both ascending and descending gradients. As for the tool, I was thinking of GRASS, but I can give FME a try. Lemme check it out. –  okello Aug 31 '12 at 10:12
Okay, about the splitting part. You probably want the polyline split at local maximums and minimums. You could first split it with a very dense interval, like 5m, then you could identify which of these new vertices represent actual extremes by comparing previous/next vertex z values. Im not familiar with GRASS myself, so im not sure. What i described would still be doable in FME. I also think theres an actuall spatial analysis you can perform in arcGIS, cant remember which one it is, that could find such extremes along a path for you –  U2ros Aug 31 '12 at 11:20
Okay, read your updates. What you are doing is COST analysis :) For that you could rasterize the roads onto the DTM itself, giving it a very low cost value - just an idea –  U2ros Aug 31 '12 at 11:23
Thanks for the suggestion, @U2ros. –  okello Aug 31 '12 at 11:45

I have FME in similiar use. LAS/contours/raster data & line vectors -> SurfaceDraper = Line which follows surface, easy, fast and costs.

My QGIS 1.8 sextante toolbox gives me GRASS command "v.drape", wich needs raster data for elevation, So it should be "easy" to do in QGIS or GRASS

share|improve this answer
Thanks @simplexio. Now, I need to get raster data for Kenya for this exercise. I'll search around for that but if you know where I can look, I'll appreciate an advice. –  okello Aug 31 '12 at 11:47

In GRASS GIS, first use v.split to add sufficiently vertices, then v.to.db to upload the slopes for each segment (parameter "slope": slope steepness of vector line or boundary).

For elevation datasets, see http://grass.osgeo.org/wiki/Global_datasets

share|improve this answer
Thanks @markusN. I'll try these suggestions this weekend, and let you guys in on my findings. –  okello Aug 31 '12 at 19:04

Your Answer


