When I first moved to Seattle, the thing that most surprised me was the number of hills. The city is, after all, better known for its rain and its coffee than for its topography. As an avid bicycle commuter back in (flat) Columbus, Ohio, I was discouraged by the steep slopes here: on many roads, I’d be forced to dismount and walk my bike, which takes some fun out of the ride. I found myself wondering if we could create an algorithm to map routes with a limit on the maximum grade, so I could stay up on my bike from start to finish.
[Google Maps Bicycle Directions: from Capitol Hill to LMN]
Google Maps now includes bicycle routing – and even shows an elevation profile – but it shows no information on slope, aside from what you can guess from the angle of the graph.
Dedicated sites like CycleRoute color code their elevation graphs, which is helpful, but their algorithm seems to find the shortest path without considering slope – from experience I know the path they traced here has some steep segments.
In order to map out – and visualize – my route, we would need to create an algorithm that combined the useful features of these two sites. If we could create a 3D visualization of the route, we could check if the result made intuitive sense. Using Rhino, Grasshopper, and several plugins, we built up a 3D model of the city, calculated the slope of each road segment, and ran a weighted shortest-path algorithm on that street network.
[SDOT Street Network Shapefile]
[SDOT 1993 Survey Contours]
First, we needed to get the GIS data. Luckily, Seattle’s Department of Transportation makes the city’s street network and topography available for free download as GIS shapefiles, which can be imported into Grasshopper with the Meerkat GIS plugin.
[Street Network Projected onto Topography Mesh]
The street network file contains no elevation data, but by projecting the intersection nodes onto a mesh generated from the topography contour lines (from a separate file), we can get an approximate elevation for each road segment’s end-points, rebuild the road segments at the proper elevation, and then calculate the slope with a simple division.
[Street Network color-coded by Grade percentage. Red = 10%+]
Once we had the grade percentage for each road segment, we could map the data range to a color gradient. The color-coded map confirms what we already know intuitively: Downtown’s streets slope dramatically down toward the waterfront, while Belltown and the Denny Triangle are relatively flat (thanks to a massive 20th century regrade project). The ridges of Queen Anne Hill, Capitol Hill and First Hill are all clearly visible.
[Shortest Path: Non-weighted Street Network]
[Google Maps: Driving Directions]
If we calculate the Shortest Walk between two points (in this case, Capitol Hill and the LMN office), we get a result similar to Google Maps’ Driving Directions: a path that takes us down I-5, and up several severe hills: totally inappropriate for a cyclist.
[Shortest Path: Grade-Weighted Street Network]
[Shortest Path: Grade-Weighted and Non-Weighted Paths]
However, if we factor grade percentage into the calculation (by multiplying grade * segment length), we get a route that minimizes grade change. (Alternatively, we could remap the slope values to maximize slope for a harder workout).
The results are even more dramatic viewed from a perspective view…:
[3D Views of Shortest Path Route]
… and even moreso when we exaggerate the topography (z-dimension scaled 1000%):
[3D Views of Shortest Path Route – Exaggerated Topography]
By exaggerating the topography, we can clearly see the benefit of using a weighted-network for this calculation. By including the grade-factor in the calculation, we’re able to map out routes that minimize elevation change, and clearly route around, rather than through, local extremes in the topography.
Some next steps: In addition to mapping out the route in 3D, we could generate an elevation vs distance graph, like the CycleRoute graph shown above, and we could output a list of roads traversed as step-by-step directions, like in Google Maps. By editing the definition and optimizing for different variables, we can determine optimal routes for a number of different use cases, while the color coded street map could also be useful as a print, for those rare times we leave the algorithms at home.
For our architectural work, this has some immediate applications. Obviously, the ability to generate topography quickly from GIS shapefiles is handy for constructing site models, both digital and physical. Wayfinding is another potential application: we could easily feed the algorithm a list of start and end points and quickly generate route imagery for location-specific signage. With some modifications, the slope analysis could be used for surface precipitation runoff calculation, or for modeling photovoltaic panel efficiency on complex forms. Depending on the GIS data sets available, a similar process could be used to visualize urban traffic flow, or as a way to analyze the circulation pathways in a campus plan.
Most important, however, is the insight such analysis can bring to designers as we find new ways to map data to experience, and make the conceptual tangible.
Header image: Seattle Topography, USGS, 1894