From: http://blog.csdn.net/tianxinzhe032/article/details/6660051
/// <Summary>
/// Calculate the Polygon Area
/// </Summary>
/// <Param name = "inputpath"> </param>
/// <Param name = "outputpath"> </param>
Public static void calculateareas (string inputpath, string outputpath)
{
ESRI. ArcGIS. geoprocessor. geoprocessor Gp = new ESRI. ArcGIS. geoprocessor. geoprocessor ();
ESRI. ArcGIS. spatialstatisticstools. calculateareas calculate =
New ESRI. ArcGIS. spatialstatisticstools. calculateareas ();
Calculate. input_feature_class = inputpath;
Calculate. output_feature_class = outputpath;
GP. overwriteoutput = true;
GP. Execute (calculate, null );
}
/// <Summary>
/// Calculate the length of a line segment
/// </Summary>
/// <Param name = "path"> </param>
/// <Param name = "field"> </param>
Public static void calculatelength (string path, string field)
{
ESRI. ArcGIS. geoprocessor. geoprocessor Gp = new ESRI. ArcGIS. geoprocessor. geoprocessor ();
GP. overwriteoutput = true;
Calculatefield calfield = new calculatefield ();
Calfield. in_table = path;
If (field. Equals (""))
Calfield. Field = "f_length ";
Else
Calfield. Field = field;
Calfield. Expression = "! Shape. length! ";
Calfield. expression_type = "Python ";
GP. Execute (calfield, null );
}