Spatial Analyst - Valid dataype for input of calculated values?

1858
3
05-19-2010 01:29 AM
StefanHaglund
New Contributor
Hi folks,

I am having problems getting calculated values to be accepted into GP tools in Spatial Analyst using ModelBuilder. What I want to do is use the Calculate Value tool to perform a calculation which will generate a number that should be sent into the Greater Than tool in Spatial Analyst.

I want to find areas in a DEM that are greater than a calculated number. My calculate Value tool works as expected and returns the number I want but when I try to connect the output_value variable as input to one of the ???Input raster or constant value??? parameters in Greater Than tool, I get the error message ???Invalid GP data type???. I have tried the available datatypes that makes sense without succeeding. See attachment for clarification.

If I want to do the same thing but input my calculated value to the Buffer tool in the Distance parameter, I just set the datatype to ???Linear unit??? and all is well.

There are obvisously workarounds to this, such as creating a new constant raster and using that raster as input into Greater Than, but my total model will be time-consuming so I want to do this as streamlined as possible.

Does anyone know how to do this or if it can be done? Is it possible to do this in Python? My previous experience with Python and Spatial Analyst is that it is pretty shaky so I haven???t tried that road yet.

I am using 9.3.1 SP1.

Thanks,
Stefan
0 Kudos
3 Replies
StefanHaglund
New Contributor
Bill,

Thank you for your suggestions! I agree with the suggestion to use the raster calculator as much as possible.

Maybe I oversimplified my problem a little bit. I use Calculate Value to fecth a value (float) from an attribute table of a feature class and use that calculated value in Greater Than. Using Calculate Value with a searchcursor and GetValue was the best way I could think of to get a value out of an attribute table and expose it as a vaiable in ModelBuilder. My example in the attachment with the �?�4+3�?� was just a simplification.

In the webhelp ( http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=6389&pid=6365&topicname=Greater_Than ) it says:
�?�A number can be used as an input; however, the cell size and extent must first be set in the environment.�?�, so it should work and it does work if I type in a value as one of the input paraemters in Greater Than.

In the old forums there was mention that this funcionality would be available in 9.2 (or maybe 9.3, not sure), so I am a little worried it still isn't there. EDIT: The possibility to use calculated values as input into Spatial Analyst tools, that is.

Thanks,
Stefan
0 Kudos
StefanHaglund
New Contributor
Just a follow-up if somone should stumble on this thread. It seems like the new Raster Calculator tool in 10 will solve this problem. See: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z000000z7000000.htm

From the help it says that:
"In ModelBuilder, the following variable types are valid inputs for an expression:
- String
- Boolean
- Numeric: Double and Long
- Data: Raster dataset, raster layer, raster band, .lyr layer file"

So using ModelBuilder this should work but I am not sure how you would be able to solve it completely within a scripting environment since Raster Calculator tool is apparently intended for use only as a tool dialog or in Modelbuilder.

Cheers,
Stefan
0 Kudos
LeonardoCorradi_Coelho
New Contributor II
On a ESRI DOC in the help topics of ArcGIS 10 about Calculate Value tool it is said that you need to use the "Formulated Raster" data type to feed the Spatial analyst tools input parameters of "Input raster or constant value" type.

It is obvious otherwise that this data type dont worked for me in ArcGIS 9.3 SP1. The tool still says the parameter is empty or is not the "Composite Geodataset" data type.

I´d set-up the environments on both tools, ie: in the Calculate Value Tool and in the Less than equal tool, but even this way the tool retuns the same error message. Yes, I know thet extent and cell size do not affect Calculate Value tool, but i still tried it, since formulated raster is a constant raster formulated to do the logical operation, and it seens logical to have the same extent and analysis cell size in both output value and in the inputs of the spatial analyst tool.

I was using the Less than equal tool.

Is it an unsolved bug? I just look for the same topic in the ArcGIS 9.3 help and the topic that says you need to use the formulated raster data type to feed the Spatial analyst Tools is not present in 9.3 like it was in 10.0 help topic. The 9.3 help topic ends in the explanation on how to feed the buffer tool with a calculated value of Linear Unit data type.

Why cant ESRI fix not working things whem they get to know it in the past versions of the software? I feel ESRI just forgot the solution in ArcGIS 9.3 and implemented it in 10.0. But if it is a not working feature of 9.3, why cant they just fix it too?
0 Kudos