Tool parameters in Map Algebra

Available with Spatial Analyst license.

Tool parameters define how a tool processes input data. Tool parameters are composed of keywords, user-defined parameters, and classes.

Tool parameter rules

  • A keyword parameter such as output_measurement has specific preset keywords (DEGREE, PERCENT_RISE), which are enclosed in quotation marks. Keywords are not case sensitive, but it is recommended that you capitalize them for readability.
    # Usage: Slope(in_raster, {output_measurement}, {z_factor})
    
    # DEGREE will be used as the default output measurement in the 
    #  following statement
    outRas = Slope("elevation", "DEGREE")

User-defined parameters are inputs that typically quantify a parameter.

  • User-defined parameters are usually numbers and are not in quotation marks.
    # In the following statement 4 is the zfactor parameter
    outRas = Slope("inraster", "DEGREE", 4)

Some input parameters are classes. Classes are used when geoprocessing tool parameters would otherwise be a more complicated string equivalent.

  • The specific arguments for the class are enclosed in parentheses. String input is in quotation marks, and numbers are not; parameters are comma delimited.
    outRas = FocalStatistics("inraster", NbrAnnulus(1, 3, "MAP"))

    For additional information, see Spatial Analyst classes.

  • To specify a default value for an optional parameter, you must use empty quotation marks.
    # In the following statement the slope calculations will 
    #  default to DEGREE; 4 is the z value
    factoroutRas = Slope("inraster", "", 4)
Note:

For readability, it is recommended that you set the class object to a meaningfully named variable and use the variable in the Map Algebra tool.

myRemapVal = RemapValue([[-3,9],[0,1],[3,-4],[4,5],[5,6],[6,4],[7,-7]])
outReclassRV = Reclassify(inRaster, "VALUE", myRemapVal, "")

Related topics


In this topic
  1. Tool parameter rules