Select to view content in your preferred language

Calculate Geometry Attributes — Automatically generate field name if left blank

374
0
02-25-2024 08:20 PM
Status: Open
Labels (1)
Bud
by
Esteemed Contributor
ArcGIS Pro 3.2.2; File Geodatabase; Line Feature Class
 

Calculate Geometry Attributes (Data Management)

You can select an existing field or provide a new field name. If a new field name is provided, the field type is determined by the type of values that are written to the field. Count attributes are written to long integer fields; area, length, and x-, y-, z-coordinate, and m-value attributes are written to double fields; and coordinate notations such as Degrees Minutes Seconds or MGRS are written to text fields.

When I use Calculate Geometry Attributes to create a new field, I get an error if the field name is left blank. A temporary field called "#" is created but not populated.

Bud_0-1708921368980.png
 Traceback (most recent call last):
File "c:\program files\arcgis\pro\Resources\ArcToolbox\scripts\calculategeometry.py", line 366, in <module>
CalculateGeometry(fc, properties, lUnit, aUnit, cs, cformat)
File "c:\program files\arcgis\pro\Resources\ArcToolbox\scripts\calculategeometry.py", line 177, in CalculateGeometry
fidxes = [ucur.fields.index(cprop[0]) for cprop in properties]
File "c:\program files\arcgis\pro\Resources\ArcToolbox\scripts\calculategeometry.py", line 177, in <listcomp>
fidxes = [ucur.fields.index(cprop[0]) for cprop in properties]
RuntimeError: Cannot find field '#'
I suppose an error of some sort might be expected. It seems like the tool was expecting the new field name parameter to be entered by the user.

But I think it would be better if the tool could automatically generate field names if the field name parameter is left blank. To save the user from manually typing in a field name for multiple fields. It would also have the benefit of creating standardized field names.