# question on how to create cost-weighted distance?

1920
4
06-21-2010 08:05 PM
New Contributor
I would appreciate feedback from a seasoned raster guru on the following problem that I need to resolve for my doctorate research. I set out to calculate food store access based on the distance to food stores from residences using bus routes in NYC. I wanted to do it with Cost-weighted Distance in Spatial Analyst. But when I started to generate grids to input into cost-weighted distance tool using I run into a problem. Here is what I have tried:

I selected raster cell size to be 5x5 feet (size I chose somewhat arbitrarily and set explicitly in Spatial Analyst > Options). I then gave bus route shapefile a new field to use when rasterizing and assumed that it takes a bus 6 about minutes to travel each mile. Thus, it would take 0.0057 minute to cross each 5x5' cell on the bus route. I also assumed that a participant will need to walk to the bus stop from the residence at the speed of 30 about minutes per mile. Thus it will take 0.0284 minute to cross each cell by food until he/she gets to the bus stop. Based on this logic, for bus travel model each bus route pixel should have a value of 0.0057 while the rest of pixels covering Brooklyn should have value 0.0284.

I then converted the 2 shapefiles (bus route and surface of NYC) into rasters and tried to combine them in order to use the values in the Value field as friction.  But when I tried to combine these new grids in Field Calculator I get the added value where bus route is (0.0057 + 0.0284). How do i merge these rasters so that all bus routes have cells with values  0.0057 and the rest of the city grid will have value of 0.0284 Not sure how to proceed??? Also, Do I set cells that fall outside of NYC as NoData?

Philippe
Tags (2)
4 Replies
New Contributor
Dear Bill,

Thank you so much for your help and insight! I will try it today and post the this thread.

Thanks again,

Philippe
New Contributor
A good place to begin, Phillippe, is by converting the bus routes to an indicator grid: NoData for cells not on a route, actual values (which can be anything) for cells on routes.  Perform the same conversion for walking access.  Let's call these grids "bus" and "walk", respectively.

Combining is easy, as I will show below, but you have to decide what impedance to assign to cells that can be ridden and walked.  Because this is a highly approximate calculation anyway (you're not accounting for bus waiting times, for time on stairs or elevators, time to cross streets, for self-intersecting bus routes, for the discrete locations of bus stops, for one-way traffic, for traffic stops or congestion, etc.), you would likely just want the bus impedance to have the priority.  In other words, you want to create a grid consisting of the walking impedance where walking alone is possible and otherwise will have the riding impedance wherever a bus route exists.

The combination I have described can be carried out in many ways; a general and efficient one is
[INDENT]Con( IsNull( [bus] ), ([walk] == [walk]) * 0.0284, 0.0057 )
[/INDENT]The mysterious expression [walk] == [walk] simply converts the values of the walking indictor grid to 1's and NoData; multiplying by 0.0284 replaces the 1's by the desired walking impedance.

This solution automatically places NoData values outside the bus routes and walkways.

Dear Bill,

Thank you so much for your help! Your approach and code worked great! I now created my grid of cost-weighted distances to all the supermarkets in Brooklyn.

I am still not sure how to deal with open spaces which most likely will not be crossed by my shoppers to on their path to the stores, like cemeteries and parks that have walls around them. I tried to attach a map but keep getting an error msg... Should I set these to NoData to make them impassible? Your feedback is much appreciated!

With warm regards from NYC,
Philippe
New Contributor
People can do crazy things, Phillippe, but even so these protected spaces will slow them down.  Just give them an impedance substantially larger than the walking impedance.  Even twice the impedance will do fine.

One way to handle pedestrian street crossings a little better is to put a relatively large impedance in the streets (but not on the sidewalks).  This will increase the calculated time to cross streets and will produce routes that cross streets perpendicularly rather than diagonally.  With some care you can even place a separate much larger impedance in the middle of each block (away from the corners) to discourage jaywalking.  (This is probably overkill but it illustrates the possibilities available to you.)

Hi Bill,
Thank you again for your assistance in conceptualizing and scripting this model. I actually generated my is cost-weighted distance different types of foods in a very simplistic way--by just designating all non-street areas in Brooklyn as "walkable" and giving the bus routes lower "friction" and the results are far from ideal. I would love to try the sidewalk approach as you suggested. Alas, I don�??t have the sidewalks shapefiles to test the approach you suggest. I do have a shapefile of all the walkable streets. Would be great to hear your suggestions.

I must say that I am skeptical about restricting New Yorkers from jay-walking ; - ) It is just such a part of the local culture that restricting street crossings to intersections may not work in NYC. But in Zurich, where don't jaywalk it would be the way to do it!

Thank you,

Philippe
New Contributor
Do you suppose a small buffer of the streets would work, Phillippe?  At your 5-foot cellsize, a three- or four-cell buffer would be a pretty accurate representation of the sidewalks.  Create such a buffer using Expand.

Dear Bill,

Thank you for your valuable insight. Yes, a buffer will work but I am not sure how to create a �??composite�?� raster that will combine walkable sidewalks, bus routes and also �??barriers�?�, like freeways, parks etc. Can I use CON statement?

My current method assumes that the residents can walk anywhere where there is no bus line at a cost of 0.0284 min. per cell. But this model produces strange, overly conservative travel-cost values. E.g., some areas on  the maps of Brooklyn are 1.5 hrs away from the supermarkets! I think that I need to set all the major non-elevated highways, cemeteries, buildings and parks as impassible (adding setting them to NoData value).

However, since the residents are geocoded to buildings, I am not sure how do I extract cost-weighted time values to points (residents�?? addresses) If I restrict the movement to spaces between buildings, to the sidewalks since the cost-weighed cells will not overlay with locations of points off the sidewalks.