Quantcast
Viewing all articles
Browse latest Browse all 248

Calculating centroid latitude in ArcMap throws error in Arcpy

I can create a centroid latitude field in ArcMap10.1 using “Calculate Geometry…” in the attribute table, but when I try the same thing using:
arcpy.CalculateField_management(bins_WGS84, “cent_lat”, “!SHAPE.CENTROID.Y!”, “PYTHON_9.3″),

I get the following error: arcgisscripting.ExecuteError: ERROR 000539: Error running expression: GPVARIANTOBJECT0.CENTROID.Y. It only happens occasionally, but kills my script and costs me lots of time/data. On the particular dataset I’m testing, it happens about 10 rows in, although the geometry looks fine and Arcmap doesn’t complain when finding the centroid. Any help is greatly appreciated.

I know it is possible, because it’s working for the same dataset in ArcMap, however, this action does not show up in the Results window.


Viewing all articles
Browse latest Browse all 248

Trending Articles