Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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


share|improve this answer

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

share|improve this answer
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 '12 at 20:40
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. –  Michalis Avraam Sep 18 '12 at 21:18

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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