Select to view content in your preferred language

multi line statement raster calculator in 10.0???

2691
7
09-19-2012 01:40 PM
ThomasDilts
Frequent Contributor
ArcGIS Help claims that it is possible to perform multi-line statements in the raster calculator but I have not been able to do so http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Building_complex_statements/00p6000000...

I'm wondering if this is a case of false advertising or if I'm missing something?

My multi-line statement is relatively simple although I'm planning on eventually making it more complicated

t1 = Raster(r"forest.tif")
t2 = Raster(r"forest.tif") * 2
t1 + t2

-Tom Dilts
0 Kudos
7 Replies
ThomasDilts
Frequent Contributor
I forgot to add that I get the following error:

ERROR 000539: Parsing error <type 'exceptions.IndentationError'>: unexpected indent (line 😎
Failed to execute (RasterCalculator).
0 Kudos
Robert_LeClair
Esri Esteemed Contributor
Tom -

According to the "How Raster Calculator works", the tool is designed for single-line algebraic expressions.  The old 9.3 "Multi-Output Map Algebra" GP tool would do the syntax (somewhat) that you're looking for.  You can implement the multi-line expression within a Python Window if you wish, but here's the syntax I used in the Raster Calculator to get the desired output.

OutRas= Raster("Viewshed") + (Raster("Elevation") * 2)

Define your output raster and you've got output.

Hope this helps!

Regards,

Robert LeClair
Esri-Denver
0 Kudos
ThomasDilts
Frequent Contributor
So multi-line is out in 10 except in the python window, but nested statements are in, right?
0 Kudos
Robert_LeClair
Esri Esteemed Contributor
Tom -

At the 10.0 release, the MOMA tool (Multiple Output Map Algebra) tool was retired in favor of the Raster Calculator.  You can execute simple single line map algebra statements or complex nested algebraic statements in the UI.  With full Python integration at 10.0/10.1, you can execute multi-line algebraic statements in the Python window or any Python IDE.  If you have any SOMA (Single Output Map Algebra) or MOMA tools in a 9.3.x release or earlier within a model, then they will execute in a 10.0 environment.  Hope this helps clarify the question.

Regards,

Robert
0 Kudos
ThomasDilts
Frequent Contributor
Got it.  Thanks a bunch for your quick response.
0 Kudos
Luke_Pinner
MVP Regular Contributor
ArcGIS Help claims that it is possible to perform multi-line statements in the raster calculator but I have not been able to do so http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Building_complex_statements/00p6000000...

I'm wondering if this is a case of false advertising or if I'm missing something?


Robert has pretty much covered it, but I just wanted to point out it's not false advertising - the help page you linked to is not for the raster calculator. It's for map algebra in the arcpy Spatial Analyst module.
0 Kudos
curtvprice
MVP Alum
Robert has pretty much covered it, but I just wanted to point out it's not false advertising - the help page you linked to is not for the raster calculator. It's for map algebra in the arcpy Spatial Analyst module.


The 10.x functional equilvalent of MOMA is to simply type the statements in the Python window.

In some ways this is vastly superior to MOMA because you get integrated intellsense and tool help as you type.

In ModelBuilder, you can place multiple Raster Calculator tools in a single model, which is a similar workflow to what MOMA provided in 9.x.
0 Kudos