Specifying input data

Available with Spatial Analyst license.

All Map Algebra statements require input on which to apply the tools and operators (except for CreateNormalRaster and CreateRandomRaster, which have only optional arguments).

Input rules

  • To use input data directly (data on disk, layers, tables, field names), it must be in a quoted string.
    # The full path and nmae of the dataset is used
    outRas = Slope("C:/Data/elevation")
    
    # If the layer is in the Table of contents or in your workspace then just the quoted name is needed
    outRas2 = Slope("elevation")
    # In the following statement Population is a field name
    outRas2 = KernelDensity("inpoints", "Population")
  • Existing input data can be assigned to a variable, and the variable can be used in a statement. Variables are not quoted.
    inputElevation = "C:/Data/dem"
    outRas = slope(inputElevation)
  • Raster objects can be used as input into subsequent statements. Since a raster object is a variable, it is not quoted.
    outSource = ExtractByAttributes("inraster", "Value > 3000")
    
    # The output of ExtractByAttributes is used as input to EucDistance
    outDistance = EucDistance(outSource)
  • Result objects can also be used as input into Map Algebra expressions.
    # Buffer returns a Result object, which is used here as 
    #   input to EucDistance
    dist = EucDistance(arcpy.Select_analysis("schools", "#", "Pop>2000"))
  • Many tools accept multiple inputs for a parameter (multivalue input). Inputs are separated by commas and enclosed in square brackets (denoting a Python list).
    outStats = CellStatistics(["inraster1", "inraster2", "inraster3"], "MEAN")

Related topics


In this topic
  1. Input rules