AnsweredAssumed Answered

raster landuse calculation

Question asked by sean.woznicki on Jul 31, 2014
Latest reply on Aug 4, 2014 by sean.woznicki

Hi Guys,


I want to calculate the counts of each landuse type based on the unique landuse code from  each raster datasets.


Raster dataset consists of six major landuse and their unique codes are below:


1) Agriculture : Landuse code(2100, 2200, 2300, 2400)

2) Barren Land: Landuse code( 7100,7200,7300,7400, 7500, 7600)

3)Forest:          Landuse code(4110, 4120, 4210,4220, 4230, 4311, 4312,4321,4322, 4410)

4)Urban:           Landuse code(1110,1120,1130,1140,1150,1200,1211,1214,1300,1400,1410,1411,1420,1440,1462,1463,1499,1500,1600,1700,1710,1741)

5)Water:          Landuse code(1419,5100,5190)

6)Wetlands      Landuse code (1461,1711,1750,1850)


Also, I want to divide the Urban area further into 4 categories.


I have the code only for agricultural area to simply test whether the code is working or not for one category of landuse. When I ran the code neither did I get any error message nor the result for agricultural land. I know it's a pretty big description, sorry for that.  Thank you very much for your time and help!

I am providing the code below:


import arcpy, os from arcpy import env  #To overwrite output arcpy.env.overwriteOutput = True  #Set environment settings env.workspace = "C:/Subhasis/Project-06-02-14/Landuse/New folder/Merged/Landuse_raster"  outws="C:/Subhasis/Project-06-02-14/Landuse/New folder/Merged/Landuse_raster/Table"   inraster = arcpy.ListRasters("*", "GRID") for i in inraster:     flds = ("VALUE", "COUNT")       dct = {row[0]:row[1] for row in arcpy.da.SearchCursor(i, flds)}          Agriculture=[]     Barrenland=[]     Forest=[]     Urban=[]     Water=[]     Wetland=[]      for j in dct:         if (dct.keys()==2100) & (dct.keys()==2200) & (dct.keys()==2300) & (dct.keys()==2400):             ag=Agriculture.append(dct.values())             print ag         else:             break