How do I get the values of each cell in the raster attribute table. Usually the attribute table gives you the value and number of counts. But, in my case I want each cell listed and corresponding cell values.

3 Answers 3


I notice you didn't mention Python at all, but it is possible to output a raster as a numpy array (arcpy.RasterToNumPyArray). Then you can iterate over the rows and columns of the array to get your result.

Assuming this is the output you want:

x    y    value
0    0    0
0    1    0
0    2    1
1    0    0
1    1    1

Then all you have to do is:

import arcpy
fOut = open('outputFile.txt', w)                # Open output file
fOut.write('x' + '\t' + 'y' + '\t' + 'value\n') # Write the header
rstArray = arcpy.RasterToNumPyArray(rasterFile) # Change rasterFile to numpy array
rows, cols = rstArray.shape                     # Return the rows, columns
for rowNum in xrange(rows):                     # Loop through the rows
    for colNum in xrange(cols):                 # Loop through the row's columns
        value = rstArray.item(rowNum, colNum)   # Get the value at the cell
        fOut.write(str(rowNum) + '\t')          # Write the row number
        fOut.write(str(colNum) + '\t')          # Write the column number
        fOut.write(str(value) + '\n')           # Write the value and a new line

Note that writing to files needs to write strings. array.item() returns an actual Python data type, hence casting it into a string here. If you are running this in ArcMap, there is no need to import arcpy (the very first line).

  • Yes, If it is in python that is much better. This is exactly what I wanted. But, this will create a text file? I want is an attribute table comes with the raster dataset.
    – tdr
    Sep 18, 2012 at 20:40
  • 1
    The attribute table that show up in ArcMap is indeed only showing zones regardless (see Jens' reply). You can replace the '\t' with ',' to generate a CSV file which can be imported in ArcMap like any other regular table to simulate the behavior. Sep 18, 2012 at 21:18
  • Correction: fOut = open('outputFile.txt', 'w') May 11, 2015 at 10:02
  • How can you modify this to include not only the x,y position in the array/raster, but also the easting,northing in the map for each cell?
    – FaCoffee
    Mar 16, 2017 at 15:50

Convert the grid to a point shapefile using Raster To Point Conversion, then view/edit/export that file's table.



It is not possible to display each cell in the raster attribute table. The raster attribute table shows zones.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.