Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

(using ArcInfo 10.0 sp3) As part of the creation of a cost-map for a cost-distance analysis, I need to create map A that is based on the following on two formulae, where S stands for slope in degrees:

  1. 20.9 tan(S)^2 + 4.18 tan(S) + 1.38 (-60 < S < -6)
  2. 52.1 x 103 tan(S)^2 + 10.4 tan(S) + 2.65 (-6 < S < 60)

In other words, for every VALUE between -60 and -6, 1 should be run, for every VALUE between -6 and 60, 2 should be run, resulting in one, combined map. I have a slope map ready. What I do not know, is how to translate this if/then statement to the Model Builder. My knowledge of Python is almost zero, so I sadly do not possess the skill to adjust the similar-but-different Python scripts which I found by search. Any ideas?

Thanks in advance.

share|improve this question
1  
To clarify, do you mean "52.1 x 103 tan(S)^2" or "52.1 * 103 tan(S)^2"? Is "x" a variable or an operator? –  Aaron May 28 '13 at 20:24
    
(1) Out of curiosity, how do you obtain any negative slopes, when conventionally all slopes are non negative? (You might be needing a path distance analysis instead.) (2) It would make much more sense if "52.1 x 103" meant ".0521", but even then this formula creates a sudden break in values at S=-6: infinitesimally smaller values of S yield 1.1715 whereas infinitesimally larger values yield 1.5575. Such breaks in an otherwise continuous model usually suggest something was not done correctly. –  whuber May 28 '13 at 21:39
    
@Aaron, whuber: my bad, I copied the numbers from a pdf and thought I had corrected the 'to the power of', but obviously not. Here is a screenshot instead:(dl.dropboxusercontent.com/u/21456821/cost.jpg) –  Ben May 29 '13 at 5:39
    
@whuber: thankfully, my research question involves a one-way trip in a certain direction. To obtain negative slopes, I used Quantum GIS with this plugin: malg.eu/directionalslope.php . Stating a direction obviously leads to the existence of negative slopes. You are right I think about using path distance instead of cost distance. –  Ben May 29 '13 at 5:43
    
Ben, if you have pre-computed directional slopes, then it will be impossible for either pathdistance or costdistance calculations to be applied correctly: the slope determines the direction, whence all routes have already been determined. This inconsistency suggests some important information is missing from your question. –  whuber May 29 '13 at 13:40
show 1 more comment

1 Answer

up vote 2 down vote accepted

This can be done using a conditional (Con) statement (see example below) using the raster calculator in ArcToolbox > Spatial Analyst > Raster Algebra > Raster Calculator. What I do not understand is how you are getting negative values in slope with -60 to 60 bounds.

Assuming that your values are bounded to -60 to 60 with a threshold of -6 the Con statement should look something like this. Please keep in mind that I did not test this so you may need to play with syntax. You were also inconsistent with your notation so I assumed that blank spaces were multiplication as was the "x".

Con("S" < -6, (20.9 * Square(Tan("S")) + 4.18 * Tan("S") + 1.38), (52.1 * 103 * Square(Tan("S")) + 10.4 * Tan("S") + 2.65))

The above statement breaks down to: IF S < -6 THEN (20.9* tan(S)^2 + 4.18 tan(S) + 1.38) ELSE (52.1 * 103 tan(S)^2 + 10.4 tan(S) + 2.65). This would apply the first equation to ANY pixels < -6 and the second equation to ANY pixels >= -6.

If you are intending to combine RESULTING values with bounds of -60 to 60 then you would create two rasters and then use Con to apply different equations in one nested statement. However, this is not at all how you have the question written.

share|improve this answer
    
Brilliant, that did the trick. I did not know that you could insert '< -6' in the con statement like that. See above for the explanation for the presence of negative slope values. Apologies for the syntax inconsistencies, I'm far from a mathematician alas. Many thanks! –  Ben May 29 '13 at 7:42
    
Ben, I warmly encourage you to plot this function that you have defined. As implemented in this answer, it is bizarre, making it difficult to conceive of how it could accurately reflect any real problem. There has to be a mistake in the formulas. –  whuber May 29 '13 at 13:42
    
I have to echo @whuber. This analysis seems a bit suspect. Also, in looking at the link you provided the notation in the second equation is 52.1 * 10^3 where you have it as 52.1 * 103. This could be simplified to a constant of 52100. –  Jeffrey Evans May 29 '13 at 14:51
    
I have been short on time, so the one thing I checked when I posted my previous comment was if the model would run. Now that I have taken a longer look, the outcomes are indeed bizarre. There is no mistake in the functions on my end, the image linked earlier shows a screenshot from the original article. It leads far from my original question, but any idea what I am missing? A link to the alineas surrounding the formulae: dl.dropboxusercontent.com/u/21456821/excerpt.jpg –  Ben May 30 '13 at 18:34
1  
@whuber - Taking everything together, I guess it would be best to put this article aside and look into other, more reliable methods. Once again, my thanks for your valuable input. –  Ben Jun 3 '13 at 13:16
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.