Syntax for Map Algebra

403
5
03-18-2013 01:53 PM
AndyFaris
New Contributor
I am just learning how to use the spatial analyst and map algebra feature and I am stuck trying to get the syntax correct for a simple problem.  I need to figure the best potential site locations for a store based upon distance from major roads.  If a location is within 1000m of a major road its scored 10, if between 1000 and 3000 meters its scored 20 and all other distances are scored 0.  None of the syntax formula's I have written seem to work.  I am working with 10.1. I have a raster dataset with the euclidian distance to the roads.

Thanks for any help
0 Kudos
5 Replies
Robert_LeClair
Esri Notable Contributor
You could use the Reclassify Geoprocessing tool to reclassify the values of your raster to 10, 20 and zero based upon a manual classification.

Good luck!

Robert LeClair
Esri-Denver
0 Kudos
JeffreySwain
Esri Regular Contributor
The reclassify that Robert suggested is the correct to develop a sort of 'cost' raster.  This could then be incorporated into the Least Cost Path or Weighted Overlay tool depending on how many criteria you had.
0 Kudos
AndyFaris
New Contributor
Thanks to you both for the response and help.  The weighted overlay seems a much easier way of getting the information.
0 Kudos
curtvprice
MVP Esteemed Contributor
I need to figure the best potential site locations for a store based upon distance from major roads.  If a location is within 1000m of a major road its scored 10, if between 1000 and 3000 meters its scored 20 and all other distances are scored 0.  None of the syntax formula's I have written seem to work.  I am working with 10.1. I have a raster dataset with the euclidian distance to the roads.


If you decide that you'd like to do something fancier than what's easy to do with the Weighted Overlay tool, Map Algebra is quite up to the task.

Reclassify is handy, but I have to say the Con function is really useful for this kind of thing. I'm assuming you're using Raster Calculator and have a raster layer called "distRas" in your table of contents. This expression, which nests one Con inside another, will do what you want:

Con("distRas" < 1000,10,Con("distRas" < 3000,20,0))

UPDATE: fixed syntax above
0 Kudos
AndyFaris
New Contributor
If you decide that you'd like to do something fancier than what's easy to do with the Weighted Overlay tool, Map Algebra is quite up to the task.

Reclassify is handy, but I have to say the Con function is really useful for this kind of thing. I'm assuming you're using Raster Calculator and have a raster layer called "distRas" in your table of contents. This expression, which nests one Con inside another, will do what you want:

Con("distRas" < 1000,10,Con("distRas" < 3000,20),0)


This was exactly what I was trying to come up with, thanks curtvprice!
0 Kudos