Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

I need to combine two layers:

  1. a drainage map (issued from a series of previous operations on a DEM) and
  2. 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 ModelBuilder, 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.

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
I think this question will need the precise wording of the Python Syntax Error edited into it before its resolution can be progressed. – PolyGeo Dec 5 '14 at 7:53

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

Your Answer


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.