# How do I find the slope of road segments with point elevation data of the same linear path

I'm currently working on a project to calculate road grade along roughly 30 miles of highway. I need to isolate and portray all sections of road with more than a 5 percent grade; in hopes of finding that there are at least 15 miles of road that fall into this category.

I currently have my line segment (road), which I generated random points along, and extracted elevation data from DEM to these points. Now I have a points shapefile and a line shapefile but cannot find a way to merge the two.

I expect that I will have to calculate the slope for each segment of the line, but in order to do that I need my line to have elevation data for each segment (which I was expecting could be taken from the point data)

I need to find a way to break my line up into segments between the points I generated in order to attach the proper elevation data (from the points). Maybe I am going about this the wrong way? I am running Arc 10.3 with unlimited license for the ArcToolbox, so I know I have the tools available to do this.

• I think a more conventional approach would be to create the slope grid from the DEM and extract those values directly. Commented Oct 7, 2015 at 17:34

Create a copy of your road. Start editing it, select line and and split into equal length segments, I’d say approximately 50 m. Convert segments to 3D shapes:

Calculate field

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

Result:

Please note both roads shown are fictions. One of them made of contour line, guess which. I wonder to see how red it would be if I’ve used slopes derived from DEM as per multiple suggestions. I hope they weren’t serious

UPDATE TO ORIGINAL ANSWER:

Picture below shows terrain slope:

Obviously engineers of the past didn’t know how to use GIS to calculate road slope:

• One reservation, arbitrarily segmenting the line every 50 m only works if your DEM has a resolution of 50m if not you are just interpolating. In that case you have to check if OP is okay with the error introduced there. The slope surface produced from the DEM with no resampling represents the slope you would get within the accuracy of the DEM (which I assume will be reported within its metadata). Great presentation otherwise. Commented Oct 7, 2015 at 20:53
• According to this webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Slope Slope is the rate of maximum change in z-value from each cell. This has nothing to do with gradient of the road. Commented Oct 7, 2015 at 21:25
• That is correct, but you divided your lines in 50 m segments, regardless of the cells of the DEM, correct me if I am wrong but doesn't that mean if for example your DEM has higher resolution you will be aggregating data while calculating the slope in your python argument?*unless the interpolate vertices option allows to place a vertice within each cell along the gradient.Then it won't be user defined rather defined based on DEM resolution. Apart from that, I believe both solutions should give similar result, as you can extract slope data for any gradient that is draped over the slope surface. Commented Oct 7, 2015 at 21:36
• Agree, I should of say significantly greater than DEM cell size.”both solutions should give similar result” – strongly disagree. Have a look at the updated answer, in this case your solution will result in absolutely flat road (contour line connects points with the same elevation) being insanely steep. Commented Oct 7, 2015 at 21:50
• +1 for the illustrations and simplicity.I half agree, there is a difference but it is not fundamental, the difference happened because you bilinear-interpolated the Z values while extracting 3rd dimension data for your segments. If you resample the slope surface at 50m resolution with same method you should have the same result. So the question is whether to stick with the DEM parameters or not, of course in most cases people will just interpolate as the project probably doesn't require high precision (or they can add ground truth pts). Same legend cut-off would've been better. Commented Oct 7, 2015 at 21:58

I suggest it would be easier to calculate the slope from the DEM:

1. Calculate a slope surface from your DEM using the `slope` function in spatial analyst.(mind the choice of slope unit here degree vs. percent rise- for your purpose you need percent rise)
2. Use the `extract by mask` function from spatial analyst and extract only cells that cover your line from the slope data, here use the Line feature (shapefile) as a mask.
3. You can either simply classify the raster to obtain values >5% and <5% OR you can change the extracted raster into points to get your points with slope value along the line and then use symbology to show all points with >5%.
• Would using percent rise give me the actual sections of road over 5% grade or would it give me the road segments with a change of 5% from one cell to the next? I read on another thread that using degree is more accurate because anything over 2.86 degrees is more than 5% grade. Commented Oct 7, 2015 at 18:09
• you can use either measures. 2.86 deg translate into 1 unit rise in 20 unit run(5% rise). In the answer above, the first step gives you slope values for all individual pixels based on change in elevation from pixels surrounding it. The second step extracts those slop values only for areas that overlay your road. its on the third step you will be able to see areas >5 % (or > 2.86deg depending on what unit you used for your slope) when you classify the extracted data. using the 5% cutoff Commented Oct 7, 2015 at 18:37
• *slope [above ] Commented Oct 7, 2015 at 21:10