The following are examples of using a complex expression to perform a conditional evaluation.The Set Null tool sets identified cell locations to NoData based on a specified criterion. The Expression parameter is dropped in this case because the condition raster is provided by the map algebra expression, which will return a raster dataset, for example, with values of 0 and 1 if it were a logical operation. In this case, the syntax of the Con tool takes the following generalized form:Ĭon(in_conditional_raster, true_raster, ) The Expression parameter should be dropped if the input conditional raster expression is used in a complex expression. With a complex expression, you can, for example, have several individual expressions nested in it, specify multiple rasters, or use other tools and operators.Īny valid map algebra expression that results in a raster can be used as an argument for any of the input conditional, true, or false raster inputs. In map algebra, more capabilities can be attained with the expression than a simple logical condition. OutRas = Con(SlopeRas, 10, 1, "VALUE < 15") Using complex expressions with the Con tool in map algebra If a cell has less than 15 percent slope, it will receive the value of true (in this case, 10) otherwise, it will receive the value identified by false (in this case, 1). Exampleįor example, to assign the value of 10 (identified as the true constant) as good for construction and 1 (identified as the false constant) as unsuitable for construction based on the slope at a cell (identified by the input conditional raster), and less than 15 percent slope is considered good, use the expression "VALUE < 15". The where clause parameter defines the expression to be evaluated using the input conditional raster. Input a false raster to provide values to be returned when the conditional evaluation is false. Input a true raster to provide values to be returned when the conditional evaluation is true. To perform conditional evaluation on a raster dataset in map algebra, input the raster dataset as a conditional raster to the Con tool. In particular, the logical tools in the Math toolbox can be used, with the Test tool being particularly useful. NoData does not equate to false.Ī number of Spatial Analyst tools can be used to create a conditional input raster. Cells assigned NoData will receive NoData as output. If only an input raster is used, all nonzero values in the input raster are considered true and all zero values are considered false. In the geoprocessing environment, there are two ways to identify whether a cell location is evaluated as true or false: by an input raster or by an input raster in which an optional input expression is applied. If the cell is evaluated as false, the output value for that location is identified in the false input. If the cell is evaluated as true, the output value for that location is identified in the true input. The values a cell will receive when it is evaluated as false are specified by the Input false raster or constant parameter.Ĭonceptually, during processing, the Con tool visits each cell location and, based on the cell's value and the conditional statement, determines if the cell is evaluated as true or false. The values a cell will receive when it is evaluated as true are specified by the Input true raster or constant value parameter. If it is evaluated as false, it will receive another value. If the cell is evaluated as true, it will receive one value. The Con tool allows you to control the output value for each cell based on whether the cell value is evaluated as true or false in a specified conditional statement. Using complex expressions with the Con tool in map algebra.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |