Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

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

share|improve this answer
    
thank you . but this example used editor to calculate area .i'd like to calculate the selected layer in combobox . –  wetland Feb 9 '12 at 19:56
    
@majid moosavi, Can you elaborate more what you mean by 'calculate the selected layer in combobox'? –  artwork21 Feb 9 '12 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 –  wetland Feb 9 '12 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 '12 at 14:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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