Calculating Polygon Area

4159
9
05-30-2011 01:21 PM
JontyKnox
New Contributor II
Hi, I am having some trouble calculating the area for individual polygons within an overall data set of 17,000 polygons.

I've completed the process many times before and while I do use the simple coding (below), I've been trying to use 'Calculate Geometry' in this instance.

Dim dblArea as double
Dim pArea as IArea
Set pArea = [shape]
dblArea = pArea.area

I have redefined my data set to PCS rather than GCS and followed all the necessary projection steps. Theoretically it should work. And yet I keep getting area values that are far to small. For example one polygon is one of the Great Lakes, with an average area of 31,820 sq mi and yet Arc is calculating the Area to ~10 sq meters.

I've tried everything I can think of. Even switching back and running the code but it makes no difference, the area still comes out too small. Any suggestions?

Cheers,
Jonty
Tags (2)
0 Kudos
9 Replies
JontyKnox
New Contributor II
I think, although I'm not completely sure, that the units of the numbers Arc is giving me are in Decimal Degrees Squared... it's the only thing that makes sense.

Which means that if I can't solve this problem I suppose I will have to do field calculator and convert Decimal degrees squared to Km sq or something like that. A rather inconvenient and long winded calculation considering I bet the solution to the Area units problem is so simple...
0 Kudos
HardolphWasteneys
Occasional Contributor III
I'm not sure what you are looking at or where you are running the code, but first have you looked in the attribute table under shape_area?   If it isn't there then Add a new field and make sure the TYPE is double or float.  Then use Calculate Geometry on that field and specify units.

Hardolph
0 Kudos
TimSpivey
Occasional Contributor III
If you need to calculate poly areas often, you might consider using the X-Tools extension. I use it on our parcel layer containing 18,000 polygons, as well as on smaller layers.

There are probably other scripts, available free from the ESRI web site, which may help you.
0 Kudos
JontyKnox
New Contributor II
@ Hi Hardolph,

I had already created a new field with double as the Type. The areas were being calculated when either I ran the code or selected calculate geometry. I specified the units- sq meters, but Arc was still returning a value of ~10 sq meters for Lake Superior and even less for other polygons of similar size.

I'm assuming its a problem with the projection but as far as I can see and all the forums advise, it all seems correct. 

@ Tift_Tax
Thanks for the advice. This is a one time calculation of area and calculate geometry seems to be working fine except for the units/low values it seems to be returning (see above). I would assume that if Calculate Geometry was working but returning wrong values then X-Tools would also as it is probably an error with my layer/projection. Am I correct? Nevertheless, X-Tools sounds interesting in general, and I may give it a try.
0 Kudos
DarrenWiens2
MVP Honored Contributor
When you add other layers, for example Great Lakes, do your polygons fall where you expect them to, or do they get squished into a very small area? It sounds like you've got the wrong projection. By the way, feature classes in geodatabases automatically calculate the areas of your polygons.
0 Kudos
MelitaKennedy
Esri Notable Contributor
When you add other layers, for example Great Lakes, do your polygons fall where you expect them to, or do they get squished into a very small area? It sounds like you've got the wrong projection. By the way, feature classes in geodatabases automatically calculate the areas of your polygons.


+1, particularly since you mentioned that you "redefined" the coordinate system. If you used the data property page in ArcCatalog or the Define Projection tool, you assigned a new coordinate system to the existing coordinate values. That would definitely explain the small area values you're getting--the coordinates are still in lat/lon. You need to redefine the data back to its GCS and then project it to the equal area projection.

Melita
0 Kudos
JontyKnox
New Contributor II
Hi Melita,
I fully understand what you said and I'm pretty sure that is the problem but I am now getting zeros across the board when I calculate the area with an equal area projection. What I did was this:
1) I defined the .shp file projection back into GCS North American 1983, which was its previous coordinate system
2) Then I defined the coordinate system to a Canada Albers Equal Area Conic projection.
3) I created a new field in the attribute table which was double, and executed a calculate geometry.

The values returned were all zero this time. I'm sure it is a projection problem and I am just doing something wrong or missing a step. Any help would be greatly appreciated.
0 Kudos
DarrenWiens2
MVP Honored Contributor
I'm not sure which tools you've used in each step, but be aware that the Define Projection and Project tools are quite different. Define Projections is used to assign the correct projection to your data. Project changes the projection (of a dataset that already has a spatial reference defined) to one of your choosing.

1.) Define the projection of your original data to what it should have started with (apparently GCS North American 1983)
2.) Use the Project tool to change the projection to the one you want (Canada Albers Equal Area Conic)
3.) Calculate geometry
0 Kudos
JontyKnox
New Contributor II
I was using the correct tools until the last step. But when I used the Project Tool to project my .shp to a Canada Albers Equal Area Conic this error kept appearing:

System Error (0): Unexpected Error.
Failed to execute (Project)

So on the off chance something would happen I used the Define Projection tool. That's why I was getting the zero values. At any rate for some reason the error is no longer appearing and the Projection tool works fine and I have now been able to calculate the area properly. Thanks for all the help it was much appreciated.
0 Kudos