AnsweredAssumed Answered

SHAPE@XY value are not centroids, instead they are truecentroids.

Question asked by irfan on Nov 29, 2018
Latest reply on Nov 30, 2018 by bixb0012

I am trying to calculate the centroids of polygons and found SHAPE@XY value are not centroids, instead they are truecentroids.

 

Script which I have used is.

 

fc=r'D:\geodb_results\Germany\admin\DE_Brandenburg.shp'

 

lstFieldsList =  ["ID", "SHAPE@XY", "SHAPE@TRUECENTROID"]

with arcpy.da.SearchCursor(fc, lstFieldsList) as searchRows:

    for searchRow in searchRows:

        print searchRow[0],searchRow[1],searchRow[2

 

Result:

120 (13.397784197052292, 52.472906875319225) (13.397784197052292, 52.472906875319225)

 

I have found the workaround to extract centriods by using SHAPE@centroid.X, SHAPE@centroid.Y.

 

Shape file is attached for your test.

 

Is this a bug or I am doing something wrong?

 

I am using ArcGIS 10.6.1.9270 on Windows Server 2008_DE with service pack 1

Attachments

Outcomes