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...

Lookup

Available with Spatial Analyst license.

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

Summary

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

Illustration

Lookup illustration
OutRas = Lookup(InRas1, "Category")

Usage

  • Both numeric (integer or floating point) or string field types are supported. If the field is integer or string, the output will be an integer raster; otherwise, the output raster will be a floating-point raster.

  • If the lookup field is of integer type, the values of that field will be written to the output raster attribute table as Value. Other items in the input raster attribute table will not be transferred to the output raster attribute table.

    For example, an attribute table of input raster with numeric field Attr1

        Value   Count   Attr1
        1       294     1
        2       345     8
        3       654     3

    Output attribute table from Lookup on Attr1 field

        Value   Count
        1       294
        3       654
        8       345
  • If the lookup field is a string type, the lookup field will appear in the output raster attribute table, and the value field will be the same numeric type as for input raster. Any other items in the input raster's attribute table will not be transferred to the output raster's attribute table.

    For example, consider the attribute table of an input raster with string field Text1

        Value   Count   Attr1   Text1
        1        294    1       A
        2       6218    8       B
        3         28    3
        4       3603    9       3

    The attribute table of the output raster from running Lookup on the Text1 field would be

        Value   Count   Text1
        1        294    A
        2       6218    B
        3         28    
        4       3603    3
  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

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 desired values for the new raster.

It can be a numeric or string type.

Field

Return Value

NameExplanationData Type
out_raster

The output raster whose values are determined by the specified field of the input 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

# 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

  • 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 or 3D Analyst
  • ArcGIS for Desktop Standard: Requires Spatial Analyst or 3D Analyst
  • ArcGIS for Desktop Advanced: Requires Spatial Analyst or 3D Analyst

Related Topics

  • An overview of the Reclass tools
  • Understanding reclassification
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