# Calculating Slope of Street Segments using ArcGIS Desktop?

Using a DEM, I need to assign slope to individual segments in a street centerline feature class. It will be used to account for increased travel time for steep slopes in a network analysis. I am using ArcGIS 10.0, ArcInfo license, with 3D Analyst and Spatial Analyst extensions available.

My initial attempt was to use the "Add Surface Information" tool. However, the resulting average slope values seem suspect in some areas, for example if a stream crosses the street segment. I would like to try assigning elevations to street segment endpoints then calculating slope. I have read about this method Calculating average slope along line using ArcGIS Desktop?) but need further details on the process.

• Please tell us what details you need. – whuber Mar 10 '14 at 20:45

If you do not care about what happens between your two ends (not that this is dangerous for long roads in hilly regions), here are the steps :

1) feature vertices to points (ask for START and for END)

2) extract values to points (for both sets of points, don't forget to check the "interpolate" box)

3) join by attributes (based on ID) the starts and the ends to your line

4) compute your "start to end" slope

• The streets are in a hilly, urban environment (longest segment <5000 ft, mean length 362 ft), so I think ignoring what happens between the ends is ok. If it was a concern, would you break up the longer roads into smaller segments? – cwb Mar 13 '14 at 16:30

The steps outlined by radouxju worked great; I added a few more specifics to the process I followed.

1) Run Data management > Features > “Feature Vertices to Points” on centerline feature class twice – once for start and once for end

2) Run Spatial Analyst Tools > Extraction > “Extract Values to Points” on the start and end feature classes, choose “interpolate”

2a) I added a field to identify start or end vertice to help keep everything straight

3) Join each feature class (Orig_FID) to centerline layer (Object_ID)

4) Calculate Slope Percent = ((End elev – Start elev) / segment length)*100

The results seem better than those from using “Add Surface Information” as reviewed by the fire chief. He uses it to help with routing trucks in the city. There are still issues with some segments as noted in my question. I think this is due to the DEM, which was created (in an undocumented process) from contours by someone else. Now I will be working up a method to find those segments with slope radically different from adjoining segments (e.g. from 4% to 24%).

I usually approach this problem with a different workflow:

1. Focal statistics on DEM with MEAN and small window like 3x3 cells (to get rid of potential artefacts in elevation data and account for the fact that the road layer does not fully represent the width of the road)
2. Zonal statistics as table with RANGE using lines as zone and filtered DEM as value raster

You can also break up the lines into smaller equal-sized segments to get better resolution and then dissolve them averaging over the gradient field.

I ran it on Seattle streets (which have a ground-truthed slope attribute) and compared my method to the ground data using linear regression:

• with the 1/9 arc-second National Elevation Dataset: R-square=0.93
• with the 1/3 arc-second National Elevation Dataset: R-square=0.82

Thank you CWB for this workflow! It was super helpful.

I added in a couple extra steps because I want to show slope regardless of direction and it was inconsistent whether the start or end point was higher in elevation. So I field calculated a "`higher_pt`" and "`lower_pt`" fields using a select by attribute ( `"end_pt" > "start_pt"` ) and so on.

Then I calculated slope using the expression `((higher_pt - lower_pt)/length)*100`

also I converted my length to meters since my elevation is meters, not sure if this was obvious to all, but you'll get crazy results if the units don't align.

i get, with the layers in utm "densify" your line layer using 10m or other divide the lines "split line at vertices" your line layer "add surface information" in you line layer using your DEM raster layer and select AVG SLOPE, so now you can classify the new vector layer to visualize the slope of segments