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.

I am experiencing a problem with the raster calculator in the Model Builder under ArcMap 10.

I need to combine two layers: a drainage map (issued from a series of previous operations on a DEM) and a slope map reclassed in 8 classes.

The formula used in the calculator is the following:

Con(("surf_drainee" > 12) & ("surf_drainee" <= 80) & ("pente_rclass" <= 24),"pente_rclass"+1, Con(("surf_drainee" > 20) & ("pente_rclass" < 24),"pente_rclass" + 2, Con(("surf_drainee" > 80) & ("pente_rclass" == 24), "pente_rclass" + 1, "pente_rclass")))

When I enter this in the calculator, using the buttons to enter the expression, it sends back a python syntax error. I discussed it with a colleague, who told me to write it out completely with the keyboard.

This works in the Raster Calculator, when used alone from the Toolbox. But when this is done in the Model Builder, it does not connect my two layers to the calculator, but creates numerous duplicates in entry to the calculator (pente_rclass (2), pente_rclass (3)...).

Is there a way of getting around this problem? I was thinking maybe a script could replace the raster calculator, but I don't really have the knowledge to set that up without a few hints...

Thank you for your help!

share|improve this question
    
I'm not sure if this will make a difference or not, but for best coding practice you need a few more braces in your expression, surrounding the parameters linked by &. For example, ("surf_drainee" > 80) & ("pente_rclass" == 24), should actually be: (("surf_drainee" > 80) & ("pente_rclass" == 24)), –  L_Holcombe Jan 29 '13 at 8:18
add comment

1 Answer

Try setting the input rasters as variables - see Building expressions in Raster Calculator, especially the example on ModelBuilder. Or perhaps try setting up your expression in the Con tool.

To pursue the python script option, see the code samples at the bottom of the Con tool help, as well as the multiple condition statement examples in the Conditional evaluation with Con help file.

share|improve this answer
add comment

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.