I have a set of points whose x and y coordinates I would like to add to the attribute table. The points are stored as a feature class in a geodatabase and I have ensured that they have the proper co-ordinate system (World Mercator).

I have tried using both Calculate Geometry Attribute and Calculate Field to add the data to the columns named X and Y but both just yield <Null> even though the tool runs successfully. For Calculate field, I am using the following Syntax:


Where am I going wrong?

I started testing at ArcGIS Pro 2.2.0 but have updated to 2.2.3 and the problem persists.

  • What is your syntax for Calculate Geometry Attribute?
    – SMiller
    Oct 25, 2018 at 3:19
  • @smiller: Target Field: 'X', Property: 'Point x-coordinate'. Target Field: 'Y', Property: 'Point y-coordinate'.
    – DotPi
    Oct 25, 2018 at 3:22
  • 1
    See updated response and report back -- try just getting the !Shape!.X rather than !Shape!.centroid.X
    – SMiller
    Oct 25, 2018 at 3:37
  • 2
    Just out of interest the X and Y fields, are they set up as integer or string? Oct 25, 2018 at 5:19
  • 1
    I just reran the model builder that was producing this shapefile a few more times and now it works!
    – DotPi
    Oct 25, 2018 at 6:09

1 Answer 1


Partially, I believe the error is in the way the field is called. The exclamation marks (!) should surround the field name, but usually methods that come after the period should not be surrounded by exclamation marks. As commented by @MichaelStimson, this is case sensitive - so make sure centroid is lowercase.

Suggested modification (tested in ArcGIS Pro 2.1.2 and ArcMap 10.5):


And separately,

  • I had already tried Add Geometry Attribute. I also just tried your suggestion. But, no change. Still showing <NULL> even though the tool executes successfully.
    – DotPi
    Oct 25, 2018 at 3:20
  • 2
    CENTROID should be centroid, python is case sensitive and will have a cow saying something like object has no property CENTROID. Oct 25, 2018 at 3:28
  • The new edits for !SHAPE!.X throws error "AttributeError: DescribeGeometry: Get attribute X does not exist"
    – DotPi
    Oct 25, 2018 at 3:42
  • Hmm, perhaps we could use the token !SHAPE@X! like what is described for SearchCursor
    – SMiller
    Oct 25, 2018 at 3:44
  • I was able to get !Shape!.centroid.x to work -- so I was wrong, need to use centroid even with points.
    – SMiller
    Oct 25, 2018 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.