Hello all,
I have written code to intersect two polygon layers, and then calculate the acres of the resulting intersected layer. To verify that my tool is giving accurate info, I've run the same process using ArcToolbox intersect, and then right click the resulting layer's field name, and choosing "Calculate Geometry" to get the acres of the intersected layer. The results from ArcToolbox and the results from my custom tool do not match. I'm getting values for the acres of the intersected layer like:
My Custom Tool: ArcToolBox:
108400.148 108423.527
17108.401 17112.09
11624.977 11627.484
85768.753 85787.251
...
So the results of my tool are in the same ball park as what I'm getting back from Toolbox, but I'd like to be able to call the same code that toolbox does when it executes "Calculate Geometry". Does anyone have sample code of how to calculate acres using Calculate Geometry?
Here is the code I am currently using:
'Get the first feature.
pUpDFCursor = pFeatureclass.Update(Nothing, False)
pFeature = pUpDFCursor.NextFeature
'Loop through all features.
Do Until pFeature Is Nothing
'Step the progress bar.
pStatusBar.StepProgressBar()
pArea = pFeature.Shape
dblArea = pArea.Area
'Calculate Acres from Area.
pFeature.Value(pFeature.Fields.FindField(strField)) = pArea.Area / 4046.85642
'Update all features with newly calculated acres.
pUpDFCursor.UpdateFeature(pFeature)
pFeature = pUpDFCursor.NextFeature
Loop
Can I call calculate geometry directly through arcobject? I'm using Visual Studio 2008, .Net.