# Thread: Calculate the centroid of a polygon in ArcMap 10.0

1. ## Calculate the centroid of a polygon in ArcMap 10.0

Hi,

I am following this guide to Calculate the centroid of a polygon:

http://resources.arcgis.com/content/...leShow&d=32482

but I get an error saying: "There was a failure during processing. Check the Geoprocessing results..."

Checking the results window i see ERROR 999999: error Executing function

Is the above guide valid for ArcMap 10? If not, how can i achieve what i want?

2. ## Re: Calculate the centroid of a polygon in ArcMap 10.0

There is now a right-click specific tool to calculate centroids in the Calculate Geometry... into a field.
You do not need to use the Field Calculator, but if you did, then you can use a Python expression instead of VBA which is now not supported.

3. ## Re: Calculate the centroid of a polygon in ArcMap 10.0

Originally Posted by kimo
There is now a right-click specific tool to calculate centroids in the Calculate Geometry... into a field.
You do not need to use the Field Calculator, but if you did, then you can use a Python expression instead of VBA which is now not supported.
Hi,

I'm not much of a coder. Can you elaborate? Is there some Python code that I cut and paste into the field Calculator?

Thanks

4. ## Re: Calculate the centroid of a polygon in ArcMap 10.0

Originally Posted by kimo
There is now a right-click specific tool to calculate centroids in the Calculate Geometry... into a field.
You do not need to use the Field Calculator, but if you did, then you can use a Python expression instead of VBA which is now not supported.

Hi. I found this tip for the "calculate geometry" useful. Is there a automated way to update a feature class, with multiple polygons, with the centroid calculations, eliminate the need for right clicking lat, long for all the polygons within the feature class? Thanks in advance for any tips/methods!

5. ## Re: Calculate the centroid of a polygon in ArcMap 10.0

There is a CalculateField_Centroids.py script as an example in the help. Here is the link:
http://help.arcgis.com/en/arcgisdesk...004m000000.htm

6. ## Re: Calculate the centroid of a polygon in ArcMap 10.0

Enlace roto ..

8. ## Re: Calculate the centroid of a polygon in ArcMap 10.0

Originally Posted by kimo
There is now a right-click specific tool to calculate centroids in the Calculate Geometry... into a field.
You do not need to use the Field Calculator, but if you did, then you can use a Python expression instead of VBA which is now not supported.
thank you for this nice guidance. I would like to know after create the X and Y of the centers, how I am able to represent them in the map?

9. ## Re: Calculate the centroid of a polygon in ArcMap 10.0

The easiest way to do this is to use the Feature to Point tool and be sure to click on the Inside button. You can find this tool under Data Management tools and then Features. If you have multipart polygons, you might want to run Multipart to Singlepart tool first on the polygons or edit the features using the Explode multipart feature button on the Advanced Editing toolbar.

10. ## Re: Calculate the centroid of a polygon in ArcMap 10.0

Feature to Point tool would be nice to use. Is there any sort of equivalent for Editor/View license level folks?

11. ## Re: Calculate the centroid of a polygon in ArcMap 10.0

Hi Tom,

You could use the calculate centroids in the Calculate Geometry into a field, export the table to a dbf and use xy events to create a new point featureclass. The only issue would be not being able to create a centroid inside the polygon. In a test case, only 3% where outside the polygon for builtup areas (Belize).

Thanks,

Arthur

12. ## Re: Calculate the centroid of a polygon in ArcMap 10.0

Dear all,

I tried to use this script for the calculation of the X and y of the centroid, but I constantly get following error:

ERROR 000539: Error running expression: float("-1357069,51744704 -253911,285439942".split()[0]) <type 'exceptions.ValueError'>: invalid literal for float(): -1357069,51744704
Failed to execute (CalculateField)

Thank you very much

Sarah Crabbe