# [sf-bike-planner:93] suitability analysis of slopes in SF vs existing SF bike plan

27 views

### amario

May 6, 2010, 6:00:30 PM5/6/10
to sf-bike-planner
From: Jess
Date: Friday, April 23, 2010, 3:13 PM

I'm a first-year student in a GIS class working on a bike project in
San Francisco, and wanted to see if you could lend some insight. I
thought it would be interesting to do a suitability analysis of the
slopes in SF and compare them to the existing SF bike plan. I've
gotten some data off the SF GOV website, including the contour & roads
data (in polylines), but I'm not quite sure where to begin. I'm having
trouble thinking about what to do with the contour polylines, and how
to get them in a form that could work with spatial analyst. I'd
appreciate it if you could lend any insight. Thanks!

Hi Jess

Could you expand on what you mean by suitability analysis?

Here's how I used the contour polylines file to get slopes for my
planner.

1. Generate graph of vertices/edges representing connections between
street intersections in SF. (vertices are lat/lon pairs, edges are
tuples of 'start vert, end vert, edge name, path type, slope' where
edge name is like "DIVISADERO ST", path type is 'BIKE LANE' or whatev,
and slope is initially 0.0)

2. Put all the vertices into a elevation_dict (associative array,
lookup table, whatever). keys = (lat,lon), values = elevation of
(lat,lon) point (initially all values are 0.0)

3. Go through the contour polylines file and for each vertex in the
dict from step 2, find the closest point in contour polylines and set
elevation_dict[vertex] = elevation of closest contour polylines point.

4. Go through all edges in graph from #1 and fill in slope, using
slope = (elevation_dict[end_vert] - elevation_dict[start_vert]) /
distance between end_vert and start_vert

Now you have slope between all intersections in SF.

From there you could proceed to check whether slope of a bike path
edge is greater that slope of an adjacent non bike path edge, if
that's the kind of thing you're interested in doing.

I did all this in python but you could probably use whatever
language. I can point you to relevant python files in the code repo
if you like.

There are other GIS experts on this list who can maybe help more if
you describe what you wanna do in GIS terms.

Let me know if you have more questions...

Amar

--
You received this message because you are subscribed to the Google Groups "sf-bike-planner" group.
To post to this group, send email to sf-bike...@googlegroups.com.
To unsubscribe from this group, send email to sf-bike-plann...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sf-bike-planner?hl=en.

### Matthew Heberger

May 6, 2010, 9:28:36 PM5/6/10
Hi Jess, Amar, and others,

Amar's workaround was incredibly clever but ther are much, much easier
ways to do this using ESRI's spatial analyst.

I would start with a proper DEM, and then overlay the streets
polylines. (Try starting with the NED, national elevation dataset.)
This will create a 3D PolylineMZ layer, which you can then run all
sorts of statistics on: mean slope, max slope, etc. This may be a lot
more meaningful than just using the elevations at the start and finish
of a polyline. (Imagine a road where both intersections are at the
same elevation, but you have to go up and down a big hill in the
middle of the block. Using a simple method will tell you the slope =
0, which is probably not what you want.)

I found that ET Geowizards was VERY helpful for these kinds of
analyses, which is not free, but a lot cheaper than an ArcInfo
license, which may also have useful tools. If you're at SF State, the
profs there will definitely be able to show you how to do this...

HTH,
Matt