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

Get Cell Value

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Retrieves the value of a given pixel using its x, y coordinates.

Usage

  • This tool is used when you need the pixel value for a geoprocessing model. In ArcMap, ArcScene, or ArcGlobe you can use the Identify tool instead.

Syntax

GetCellValue_management (in_raster, location_point, {band_index})
ParameterExplanationData Type
in_raster

The raster that you want to query.

Mosaic Dataset; Mosaic Layer; Raster Layer
location_point

The X and Y coordinates of the pixel location.

Point
band_index
[band_index,...]
(Optional)

Specify the bands that you want to query. Leave blank to query all bands in a multiband dataset.

Value Table

Code sample

GetCellValue example 1 (Python window)

This is a Python sample for the GetCellValue tool.

import arcpy
result = arcpy.GetCellValue_management("C:/data/rgb.img", "480785 3807335", "2;3")
cellSize = int(result.getOutput(0))
print(cellSize)
GetCellValue example 2 (stand-alone script)

This is a Python script sample for the GetCellValue tool.

'''====================================
Get Cell Value
Usage: GetCellValue_management in_raster location_point {ID;ID...}
'''   
   
import arcpy
arcpy.env.workspace = "C:/Workspace"

# Get the Band_2 and Band_3 cell value of certain point in a RGB image
result = arcpy.GetCellValue_management("rgb.img", "480785 3807335", "2;3")
cellSize = int(result.getOutput(0))

# View the result in execution log
print(cellSize)

Environments

  • Current Workspace
  • Scratch Workspace

Licensing information

  • ArcGIS for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related topics

  • An overview of the Raster toolset
  • Environment settings for raster data

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
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal