Using KCMO’s open data to calculate the slope of potential bike routes

A continuous raster surface can also be used to illustrate the slope of Kansas City’s streets

There’s a lot of innovation and progressive policy to celebrate in Kansas City, but my favorite is the City’s commitment to open data. Its GIS data (available for download on the City’s online mapping under the “Download” tab) is particularly helpful to any planner or other civic nerd wanting to contribute to learn more about the city or contribute to planning initiatives.

As the City updates its bike plan and explores new bike routes, there are a number of key variables to consider. The variable I’m most interested in (as someone who isn’t in the greatest cycling shape) is the grade of these potential routes.

There are probably a number of different ways to figure the average slope (including creating a raster slope map of the city using that contour data). Here’s a quick step-by-step guide to a “spatial join” method that ties the slope directly to each street centerline segment.

Step 1: Spatial Join Contour Features to Street Centerline Features


Spatial Join Screen Capture

(click for full resolution)

First, GIS will search for every contour and find the highest and lowest elevation along the street centerline (which has been divided into blocks) through a spatial join operation. This can take some time, depending on the size of the geography being joined.

Spatial Join Results Screen Capture

(click for full resolution)

Step 2: Calculate Slope

With the minimum and maximum elevation of each centerline segment, and the length of each segment already calculated, we have everything necessary to calculate the percent slope of each segment. In field calculator, that equation is generally:

((Max slope – Min slope) / Length) * 100

Slope Calculation Screen Capture

(click for full resolution)

There are a number of “0” entries in the minimum and maximum elevation fields. This just means that there were no contour lines intersecting that particular street segment. Barring more detailed elevation data, we can safely assume the slope is about zero.

Step 3: Symbolize

Symbology Settings Screen Capture

(click for full resolution)

I’ve chosen 0%-1%, 1%-2%, 2%-5%, 5%-15%, and 15% and up as the slope categories for this map. Everything greater than 15% is most likely an area where there’s a bridge not represented in the elevation contours. These segments can be ignored or manually adjusted.

The final data can be viewed in the map below. Or, you can download the geoJSON file.

Caveat: This method assumes a constant direction in slope within a centerline segment between the minimum and maximum elevation. This isn’t always the case. Sometimes, elevation increases and decreases within the span of a single block. As a result, slope could be underestimated in certain blocks. However, because the centerline segments are relatively short (the length of a city block), these are limited to relatively short runs in a few locations at the tops or bottoms of hills, and it shouldn’t be too problematic in a planning exercise.


  • Forget being in shape, there are a number of slopes on the JoCo side trails that are dangerous. Impassable when wet, dangerous for experienced riders when dry. Some don’t even have warning signs.

    This is good work. If planners don’t use it, keep it up so we can try to shame them into fixing the worst routes they do make.

    Next: get hired by Google and have them bake a checkbox “least hilly safe bike route” into their mapping system. Took a lot of effort to find those in city of SF, but some places (like parts of KC), it really, really matters.