Lookup (Spatial Analyst)

Summary

Creates a new raster by looking up values found in another field in the table of the input raster.

Usage

Syntax

Lookup (in_raster, lookup_field)
ParameterExplanationData Type
in_raster

The input raster that contains a field from which to create a new raster.

Raster Layer
lookup_field

Field containing the values for the new raster.

Field

Return Value

NameExplanationData Type
out_raster

The output reclassified raster.

Raster

Code Sample

Lookup example 1 (Python window)

This example creates a new raster determined by the specified field of the input raster.

import arcpy
from arcpy import env  
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outRaster = Lookup("mycity","land_code")
outRaster.save("C:/sapyexamples/output/mylandcode.img")
Lookup example 2 (stand-alone script)

This example creates a new raster determined by the specified field of the input raster.

# Name: lookup_example02.py
# Description: Creates a new raster by looking up values found in another 
#              field in the table of the input raster.
# Requirements: Spatial Analyst Extension
# Author: ESRI

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

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

# Set local variables
inRaster = "mycity"
lookupField = "land_code"

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

# Execute Lookup
outRaster = Lookup(inRaster, lookupField)

# Save the output 
outRaster.save("C:/sapyexamples/output/mylandcode")

Environments

Related Topics

Licensing Information

ArcView: Requires Spatial Analyst or 3D Analyst
ArcEditor: Requires Spatial Analyst or 3D Analyst
ArcInfo: Requires Spatial Analyst or 3D Analyst

6/29/2011