I have two different line and polygon features with the same geometry. I calculated the X and Y coordinate values using the python expressions !shape.TRUECENTROID.X! and !shape.TRUECENTROID.Y! and the returned values in both features are different.
I'm doing something wrong?
Can any one help me?
If you converted the polygon to its polyline representation and if the algorithm used to determine the truecentroid is the same for a closed loop polyline and its polygon representation are the same,... then yes.
However, there is no indication of what is actually used for closed loop polylines, then just indicate polylines, so that may not be the case. You can experiment to see what value is being returned and compare the results of the center of the x,y coordinates, the centroid and truecentroid for both a closed-loop polygon and its polygon representation.
Thanks again for your reply.
You are probably right, but I was hoping that someone from ESRI confirm it!
Even do, all geometries have the same number of points and they should return the same values.
If you want someone from esri, then the quickest route is to contact Tech Support.
The assumption has nothing to do with the number of points, it is how the points are used. The only way they would return the same value is if the average of the coordinates were used (perhaps ignoring the duplicate first and last point... even that isn't clear).
The centroid and truecentroid for polygons will also differ for multipart features. In fact the centroid may not even be within the polygon (or polyline) since they are weighted. Hopefully you haven't been looking at multipart shapes?