# Measuring area of raster classes?

Are there any tools or methods in ArcMap that can measure the area of each level of the kernel density output?

Note this is just a kernel density plot (not a shape file or polygon). Kernel Density Analysis (dark green (10%) to red (90%) (1)

I have tried a few things but i need it to be accurate. I would use the following workflow to calculate the area within the classes:

1. Reclassify (Spatial Analyst) the kernel density output to whichever classes you are using. By default ArcGIS creates a continuous raster surface for the kernel density output, but reclassifies the legend (which is temporary). Using the reclassify tool will make this permanent.
2. Open the reclassified kernel density attribute table and observe the "COUNT" field (Figure 1). This is the count of all the pixels in each class. For example, Class 1 (Value = 1) has a count of 620,063 pixels. Since my coordinate system is UTM, the units are in meters and the pixels are at 1m spatial resolution. Therefore, Class 1 is 620,063 m^2.
3. To convert the count to other units such as hectares, add a new field in the attribute table.
4. Calculate field (Figure 2)
5. Logic check the results by highlighting a class (Figure 3)

Figure 1 Figure 2 Figure 3 If you want an arcpy solution:

``````import numpy as np  #not sure how arcpy imports numpy

for val in np.unique(r):
area = np.sum(r == val)  #multiply this by your pixel area
print 'value ', val, ' : ', area
``````

alternatively you can write the values to a csv/text file.

Assuming that your kernel density plot is a raster created using the kernel density tool or similar, this is just a matter of using the Raster to Polygon tool.

Make sure you specify the field that defines the classification of the raster and it will convert it to polygons. You can then use the Calculate Geometry tool to calculate area.

• I have tried that. when i drag the raster file in it says "one or more dropped items were invalid". The error suggests that there is text in the file is "interfering" do you have any idea why this may be? – Mr Angus Jul 11 '14 at 9:08
• @MrAngus The problem is that Kernel Density always produces a floating point raster output, while Raster to Polygon requires an integer raster input (see linked help files). You would need to reclassify the KD raster first. – Chris W Jul 11 '14 at 21:14
• Note that Calculate Geometry is per feature and will not give total area of all polygons sharing a given class. – matt wilkie Jun 15 '17 at 20:27

One quick solution to this is a manual solve:

1. Open the properties of the raster and go to the symbology tab.
2. Presumably the symbology is already set to Classified and the number of classes are what you want. Click the Classify button.
3. On the right side of the dialog is a Break Values box. Click each break value and at the bottom of the dialog you will see # Elements in Class. This is a count of the pixels in that class. Write the number down for each class or enter it into a spreadsheet.
4. Cancel out back to the raster properties and switch to the Source tab. The cell size is given there in x,y. Multiply these two together and you have the area of one pixel.
5. Now take that area times the number of pixels in each class. This should give you that class' total area.

Accurate is a relative term. As far as your raster areas go, it will be exactly accurate. If you use Fezter's method, the area may differ depending on whether you use Smooth when converting the pixel based regions to polygons.