i'd like to develope an application with arcengine that can calculate area of a polygon .

i wrote the below code to select a polygon in combobox

 for (int i = 0; i < pmapcontrol2.LayerCount; i++)
                    {

                        Pfeaturelayer = (IFeatureLayer)pmapcontrol2.get_Layer(i);
                        if (Pfeaturelayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                        {


                            cmbfeaturelayer.Items.Add(pmapcontrol2.get_Layer(i).Name);
                        }
                    }

but i couldn't wrote code to calculate pfeaturelayer area . i think i should use Ilayer interface and Ilayer use Ifeature to calculate area not ifeaturelayer . is there any way to use Ifeature for this application ? thank you.

link|improve this question

0% accept rate
feedback

1 Answer

Here is a link for some sample code that calculates area of selected polygon feature.

http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/Area_Example.htm

link|improve this answer
thank you . but this example used editor to calculate area .i'd like to calculate the selected layer in combobox . – majid moosavi Feb 9 at 19:56
@majid moosavi, Can you elaborate more what you mean by 'calculate the selected layer in combobox'? – artwork21 Feb 9 at 20:22
,i have a combobox and a button .when i click to the button ,the program calculate area of the selected layer in combobox and show the area in messagebox. thanks – majid moosavi Feb 9 at 21:19
IArea.Area property gives you the area size. If you'd like to compute the combines area of all selected polygons you will need to iterate through a cursor of features and add the areas then display in your control. – Jakub Feb 10 at 14:32
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.