# Polygon Centroid: Center of gravity & Inner Centroid

Discussion created by Playa on Apr 18, 2016
Latest reply on Apr 18, 2016 by Dan_Patterson

I thought I'd share the following with the community:

```'''
Created on Apr 18, 2016

Centroid

of Polygon

@author: PeterW
'''
import arcpy
from arcpy.arcobjects.geometries import PointGeometry

input_fc = r"E:\Proposals\2016\what3words\Calcs.gdb\ftr_dwellings_zola_tm19"
output_fc = r"E:\Proposals\2016\what3words\Calcs.gdb\Centroids_Test15"

def coord_sys(input_fc):
projection = arcpy.Describe(input_fc).spatialReference
return projection

projection = coord_sys(input_fc)

def centroid(input_fc, output_fc):
with arcpy.da.SearchCursor(input_fc, "SHAPE@XY") as scur:  # @UndefinedVariable
centroid_coords = []
for feature in scur:
centroid_coords.append(feature[0])

point = arcpy.Point()
pointGeometryList = []

for pt in centroid_coords:
point.X = pt[0]
point.Y = pt[1]

pointGeometry = arcpy.PointGeometry(point, projection)
pointGeometryList.append(pointGeometry)

arcpy.CopyFeatures_management(pointGeometryList, output_fc)

centroid(input_fc, output_fc)
```

Centroid: Center of Gravity

```'''
Created on Apr 18, 2016

Inner Centroid

of Polygon

@author: PeterW
'''
import arcpy

input_fc = r"E:\Proposals\2016\what3words\Calcs.gdb\ftr_dwellings_zola_tm19"
output_fc = r"E:\Proposals\2016\what3words\Calcs.gdb\Centroids_Test7"

def coord_sys(input_fc):
projection = arcpy.Describe(input_fc).spatialReference
return projection

projection = coord_sys(input_fc)

def inner_centroid(input_fc, output_fc):
inner_centroid_geom = []
with arcpy.da.SearchCursor(input_fc, "SHAPE@") as scur:  # @UndefinedVariable
for feature in scur:
inner_centroid_pnt = arcpy.PointGeometry(feature[0].labelPoint, projection)
inner_centroid_geom.append(inner_centroid_pnt)
arcpy.CopyFeatures_management(inner_centroid_geom, output_fc)

inner_centroid(input_fc, output_fc)
```

Centroid: Inner Centroid