ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Rank

Available with Spatial Analyst license.

  • Summary
  • Illustration
  • Usage
  • Syntax
  • Code Sample
  • Environments
  • Licensing Information

Summary

The values from the set of input rasters are ranked on a cell-by-cell basis, and which of these gets returned is determined by the value of the rank input raster.

Illustration

Rank illustration
OutRas = Rank(ConstRas, [InRas1, InRas2, InRas3])

Usage

  • In the list of input rasters, the order is irrelevant. However, the Rank input raster must precede these.

  • An arbitrary number of rasters can be specified in the input rasters list.

  • If a cell location contains NoData on any of the input rasters, that location will be assigned NoData on the output.

  • If all of the input values are the same for any cell location, regardless of the specified rank, the output for that cell location will be that value.

  • If the rank raster value is greater than the number of input rasters, each cell location on the output will be assigned NoData.

  • If any of the input rasters are floating point, the output is floating point; otherwise, it is integer.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Syntax

Rank (in_rank_raster_or_constant, in_rasters)
ParameterExplanationData Type
in_rank_raster_or_constant

The input raster that defines the rank position to be returned.

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

Raster Layer | Constant
in_rasters
[in_raster,...]

The list of input rasters.

The input defines the argument list to identify the value for the rank, defined by the first argument for each cell location.

Raster Layer

Return Value

NameExplanationData Type
out_raster

The output raster.

For each cell in the output raster, the values in the input rasters are sorted from lowest to highest, and the input rank raster's value is used to select which will be the output value.

Raster

Code Sample

Rank example 1 (Python window)

This example performs a rank operation on several input Grid rasters and outputs the result as a TIFF raster.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outRank = Rank("cost", ["degs", "negs", "fourgrd"])
outRank.save("C:/sapyexamples/output/outrank.tif")
Rank example 2 (stand-alone script)

This example performs a rank operation on several input Grid rasters and outputs the result as a Grid raster.

# Name: Rank_Ex_02.py
# Description: Returns the value of a set of rasters based on
#              a rank level specified by another raster 
# 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
inRankRaster = "cost"
inRaster01 = "degs"
inRaster02 = "negs"
inRaster03 = "fourgrd"

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

# Execute Rank
outRank = Rank(inRankRaster, [inRaster01, inRaster02, inRaster03])

# Save the output 
outRank.save("C:/sapyexamples/output/outrank")

Environments

  • Auto Commit
  • Cell Size
  • Compression
  • Current Workspace
  • Extent
  • Geographic Transformations
  • Mask
  • Output CONFIG Keyword
  • Output Coordinate System
  • Raster Statistics
  • Scratch Workspace
  • Snap Raster
  • Tile Size

Licensing Information

  • ArcGIS for Desktop Basic: Requires Spatial Analyst
  • ArcGIS for Desktop Standard: Requires Spatial Analyst
  • ArcGIS for Desktop Advanced: Requires Spatial Analyst

Related Topics

  • An overview of the Local toolset
  • Finding the value from an input list meeting a specified criteria
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal