Highest Position (Spatial Analyst)

License Level:BasicStandardAdvanced

Summary

Determines on a cell-by-cell basis the position of the raster with the maximum value in a set of rasters.

Illustration

Highest Position illustration
OutRas = HighestPosition([InRas1, InRas2, InRas3])

Usage

Syntax

HighestPosition (in_rasters_or_constants)
ParameterExplanationData Type
in_rasters_or_constants
[in_raster_or_constant,...]

The list of input rasters for which the position of the input with the highest value will be determined.

A number can be used as an input; however, the cell size and extent must first be set in the environment.

Raster Layer | Constant

Return Value

NameExplanationData Type
out_raster

The output raster.

For each cell in the output raster, the value represents the position of the raster with the highest value.

Raster

Code Sample

HighestPosition example 1 (Python window)

This example evaluates several input rasters and returns as an output value the position in the list of the raster with the maximum value.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outHighestPosition = HighestPosition(["degs", "negs", "fourgrd"])
outHighestPosition.save("C:/sapyexamples/output/outhp.img")
HighestPosition example 2 (stand-alone script)

This example evaluates several input rasters and returns as an output value the position in the list of the raster with the maximum value.

# Name: HighestPosition_Ex_02.py
# Description: Determines the position of a raster with the maximum
#              value in a set of rasters
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inRaster01 = "degs"
inRaster02 = "negs"
inRaster03 = "fourgrd"

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute HighestPosition
outHighestPosition = HighestPosition([inRaster01, inRaster02, inRaster03])

# Save the output 
outHighestPosition.save("C:/sapyexamples/output/outhp")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires Spatial Analyst
ArcGIS for Desktop Standard: Requires Spatial Analyst
ArcGIS for Desktop Advanced: Requires Spatial Analyst
4/10/2014