Select to view content in your preferred language

Need help with calculating area for land cover

19616
24
07-12-2011 08:22 AM
NitishaShrestha
Emerging Contributor
Hi,

I am trying to calculate the area for each classification in NLCD land cover data.

I tried adding field in the attribute table but it does not let me use calculate geometry. I also tried using tabulate area from spatial analyst tool but that does not work either. Please help.

Thank You,
Nitisha
Tags (2)
0 Kudos
24 Replies
NitishaShrestha
Emerging Contributor
Hi Nitisha - In my opinion the easiest method to calculate area of a land classification raster (be it NLCD or ReGAP) is to do a conditional statement on the raster to make each land type its own raster layer and then convert those raster layers to polygons.  For example, if you have a land type that's called 'Deciduous Forest' you can use the 'Con' tool in Spatial Analyst to create a new raster layer that only has Deciduous Forest.  Once the raster is created you can convert this to a polygon using the 'Raster to Polygon' tool.  The resulting shapefile will include a column called 'Shape_Area' that will give you the area of Deciduous Forest. 

I know there are many ways you can approach this problem but this is the method that I've used personally many time as it's fairly straightforward and quick in my opinion.  Let me know if you need any more help.  Good Luck.


How do I perform conditional statement on the raster ?

Thank you,
Nitisha
0 Kudos
MatthewNordhagen
Frequent Contributor
Nitisha - A conditional statement can be confusing at first just because the tool isn't entirely intuitive if you're not too familiar with it.  In your case the input conditional raster and the input raster or constant value will both be your NLCD dataset.  The reason you're going to input the same raster twice is because of the SQL statement that you will use.  ESRI in their resource center explains it a little more clearly.

The values a cell should receive when it is evaluated as true are specified by the Input true raster or constant value. The values a cell should receive when it is evaluated as false are specified by an Input false raster or constant.  Conceptually, during execution, the Con tool visits each cell location and, based on the cell's value and the conditional statement, determines if the cell is evaluated as true or false. If the cell is evaluated as true, the output value for that location is identified in the true input. If the cell is evaluated as false, the output value for that location is identified in the false input.

In your case (and we'll use the deciduous forest example) when the tool runs it will analyze each cell and determine, based on your SQL statement, if that cell is either deciduous or not.  If it's false the tool will define that cell as NoData.  If it's true than that cell will be given the value of deciduous forest.  I can't recall what the attribute table of the NLCD dataset looks like but your SQL statement will be similar to the following.

Lc type = Deciduous Forest.


Select OK on the tool and it will churn through the dataset and output a raster that should show only deciduous forest and nothing else. 

As for your second question, you do not need to create an empty shapefile.  After finishing with the Con tool you can navigate to Conversion Tools > From Raster > Raster To Polygon.  This will convert your new deciduous forest raster to a polygon.  The result of this tool will be a shapefile of all deciduous forest and a column specifing the area in the attribute table.

If you need anymore help please let me know.  Good luck 🙂
0 Kudos
NitishaShrestha
Emerging Contributor
Hi Matthew,

Thank you so muchhhhhhhh for your help 🙂
I tried to follow your suggestions step by step and I wanted to make sure if I was doing it correctly. It would be great if you could see the attachments and let me know if I am doing it correctly.

1) I have attached the attribute table for NLCD dataset (Attribute table). I have highlighted Open Water.
2) For the Expression (optional), I chose Value=1 (Open Water)
I thought this is the "Lc type = Deciduous Forest" that you mentioned earlier (the Con tool is also attached)
3)The attribute table for the Open raster is also attached as the "New Attribute table." Since the count column had different number I was not sure if I was doing it correctly (In initial table the count is 28575800 and in the new table it is 2630).
4) As you suggested, I changed the raster to polygon. I have attached this attribute table as well " Polygon attribute table." Sine it did not have the Area column, I added a new field "Area" and I selected the Type "Double".Then I used the calculate geometry tool. I have attached that attribute  table as well "Polygon Area Attribute Table".

Once again thank you so much for your help. Sorry to send you such a long message.
0 Kudos
NitishaShrestha
Emerging Contributor
Sorry I forgot to post this in my earlier message.

5) Since I changed the raster to polygon, while calculating the area won't there be chances of not having an accurate result (like some polygon will have more or less area than the initial raster). I have attached the arc map "Raster to Polygon" (Pink is the polygon and the navy blue is the con raster).

Once again thank you,
Nitisha
0 Kudos
MatthewNordhagen
Frequent Contributor
Hi Nitisha - You're very close!  There's a couple things I would recommend.  For your SQL statement instead of using 'Value = 1' I would use your 'Modified_a' column instead.  You'll also want to use the SQL Query Builder to make sure everything is legit (the query builder button is to the right of 'Expression' in the Con tool with SQL in tiny letters).  In the Query Builder the attribute table's fields will show up in the list.  You double click the field you want to to include, select the '=" button and select 'Get Unique Values'.  Double click "Open Water", select 'Verify'.  Verify should have been successful and then select OK.  Your SQL statement will look more like this,

"Modified_a" = Open Water


Attached is a screenshot of the Query Builder in case you weren't familiar with it.

Let me know if this resolves the descrepancy in the pixel count. 

Secondly, I apologize for the directions I sent earlier.  I thought for some reason that the Area column would have been included in the attribute table but I was mistaken.  Adding the column yourself and calculating Geometry works just as well.  You can also import the shapefile into a Geodatabase too since that procedure will automatically calculate the area for you.  It's kinda six of one or half a dozen of another.  Adding the column and calculating Geometry is probably the the quickest way.  Whatever works best for you.  Also, I forgot to tell you that you should deselect the simplify polygon checkbox in the Raster to Polygon tool.  Sorry!  This way no generalization will occur and the area of the polygon will be true to the area of the raster. 

I hope this clears things up for you.  Again, please let me know how it turns out and if you need anymore help 🙂
0 Kudos
NitishaShrestha
Emerging Contributor
Hi Matthew,
Once again thank you so much for ur help and time.

I followed the steps you mentioned for the query builder but the count is still 2630 instead of 28575800 .:(
0 Kudos
MatthewNordhagen
Frequent Contributor
Nitisha - What area of the U.S. are you trying to analyze or is this for the whole U.S?  I thought that if I could go download the NLCD data myself I could try it and see if I get different results.  It's also easier for me to troubleshoot if I had the data set in front of me.  Anyways let me know.  We'll get it figured out eventually!
0 Kudos
NitishaShrestha
Emerging Contributor
The area I am analyzing is silver and eagle creek watershed in Ohio. But I had to clip the area of interest using a buffer.

I am working on NLCD- 1992 and 2001 retrofit Land Cover Change.
http://www.mrlc.gov/multizone_map2.php

I think I used 7 zip instead of winzip to unzip the data .

Thank you so much
0 Kudos
MatthewNordhagen
Frequent Contributor
Hello Nitisha - So, first off, I need to apologize again for not reading your post closely enough.  I didn't realize that the NLCD data set was an Imagine file.  Imagine files don't work with the Con tool.  This will add one extra step for you but you need to convert your NLCD data set to a GRID file.  The easiest way to convert the data set is to right-click on the NLCD layer in the Table of Contents, navigate to Data and then Export Data.  Set the format to GRID, name your file and then select save.  The process shouldn't take very long for you.  The entire state of Ohio took about 7 minutes to convert.

With the data set converted to the GRID format you can now use the Con Tool to select only those pixels identified as open water and then use the Raster to Polygon tool to convert the pixels to polygons.  I did the entire process from beginning to end and I had no pixel difference between the original raster and the open water raster.

Again, sorry for the runaround over the last several days.  So the steps should be as follows,

1)  Convert NLCD data set to the GRID format by using the Export Data option.
2)  Use the Con Tool to create a new raster based on a SQL expression that identifies only Open Water.
3)  Use the Raster to Polygon tool to convert the raster created in step 2 to polygons (remember to deselect 'simplify polygons').
4)  Create a new column in your new shapefile created in step 3 and calculate the area using Calculate Geometry.

Please let me know if this works for you.  Good luck 🙂
0 Kudos
NitishaShrestha
Emerging Contributor
Hello Matthew,

Once again THANK YOU !!!!Please dont apologize I should have mentioned in my earlier messages that it is a img file..Sorry

I am having problem converting NLCD data set to a GRID file. An error message pops- 'Failed to save raster dataset'. I have attached the export raster data.

Thank you so much for your time,
Nitisha
0 Kudos