Ask A Cartographer

Calculating an area in raster

May 06 2010 | 4 comments
Categories: Map Data

I have a tile from Landsat imagery. I displayed in Envi bands of my interest and received a RGB raster. I uploaded my raster image to ArcMap and now I am looking for the way to calculate an area displayed in a particular color: in my case in blue. I tried reclassifying, but this did not solve my problem. Could you, please suggest any solution?

Mapping Center Answer:

Without classifying the image, you can do this by selecting cells from a single band. In ArcMap, click the Add Data button, navigate to the location of the RGB raster, and then double click the name of the raster to see the individual bands. Note that although you want to select the cells that have a blue color in the composite RGB raster, you might find that the red or green bands actually display the area in blue with a more uniform gray tone. So try adding all three individual bands and seeing which one shows the blue area in a more uniform gray tone.

On the raster that has the most uniform gray tone for the blue area, use the Identify tool on the Tools toolbar to see what the pixel values of the area that is blue in the composite image are. Once you have the pixel value or range of values, use the Con tool to perform a conditional evaluation on the one raster band.

  • The input conditional raster will be: the one raster band
  • The expression will be something like: Value > 20 AND Value < 40 (use the SQL Query Builder to make sure your syntax is correct; the values you use will of course be different)
  • The constant value will be something like: 1
  • If you do not fill in the Input false raster or constant value, then all the other cells will be NoData
  • The output raster will be: whatever you want to name it
  • Once the tool runs, you should have a raster that contains only those cells that fit the criteria of your expression.

An easy way to find the area is to right click the output raster that you just created, click Properties, click the Symbology tab, and note the Count for the pixels that are displayed. Click the Source tab and note the cell size and linear units. Now just multiply the cellsize by the count to get the area in square units of whatever the linear units were. This solution will work if you are able to isolate the cell value or values for the blue area only. If the cell values in the blue area are also found in other areas, you will know when you look at the output raster from the conditional statement.

If this is the case, you will have to take a bit more time and expend a bit more effort to actually classify the RGB raster. This Help Topic will get you started. Multivariate classification will probably be your starting point. 

Note that in ArcGIS 10 we have added an Image Classification toolbar which "provides a user-friendly environment for creating training samples and signature files for supervised classification. It also serves as a central location for performing both supervised classification and unsupervised classification using ArcGIS Spatial Analyst".

dumb posted by chris dwyer on Dec 1 2010 2:08PM
Really - that's a solution? See how many pixels there are and multiply by size? How about being able to add an area field with, instead of a calculate geometry option, a calculate raster.
This seems to simple so there must be some technical hurdle that you're going to have to explain to me why it can't be done.
Not so dumb posted by Aileen Buckley on Dec 1 2010 6:39PM
It really does not make sense to add an area field to a raster dataset since the value for each row in the attribute table would be the same (it would be the area of the pixel itself and all pixels would have the same value!)

So instead what you need to do is to find out how many pixels have the value that you are interested in and then find out what amount of area is covered by all those pixels.

You can either do this using the method described above or using the Summary Statistics tool with the raster dataset as the Input table, Count as the Statistics Field, Value as the Case field. With this method, you add an extra step because you now have to open the table and view the total counts and you have to find the count for the value that you are interested in. (But it is a nice solution if you wanted to find the counts for all the values and you wanted to then add a field to THIS and calculate the area.)

Given that you only wanted to find the area for one value, the method we originally suggested (looking at the count in the Symbology tab) is the fastest and easiest way to get the answer you were looking for.

In either case, you still have to multiply the count by the pixel area.

If you wanted to take even more time, you could convert the raster dataset to a polygon feature class and then use the method that you suggested.
Area Calculation posted by Jill Heaton on Apr 7 2011 11:32AM
Hi Aileen - been a long time. Jill from OSU. Anyway, I have to agree with the original comment that a simple GUI button or something of the like would be ideal for area calculations in a raster. I've got several raster vegetation models and instead of an easy summary tool to get area for each vegetation class (many 10's of classes) I have to export the table for each raster model, open in excel, write formula (easy of course) to multiple number of raster cells by area to get area per vegetation class. Totally doable, but would seem a nice feature to be able to summarize area by raster class directly in ArcMap. I just started using 10 today so hopefully I'll find a quick solution.
Zonal Geometry posted by Aileen Buckley on Apr 7 2011 12:15PM
Hi, Jill! Good to hear from you! For your case, you can use the Zonal Geometry tool which will calculate the area (or other geometry types such as perimeter) of each zone (i.e., veg type) in an output raster.

This is different from the original question in which the user wanted to calculate the area of all pixels with a specific color -- blue. In his case, there were no zones (the pixels were not classified into something like vegetation types.)

Let us know if this works for you!

If you would like to post a comment, please login.

Contact Us | Legal | Privacy |