arcpy.management.AddGeometryAttributes

1025
2
Jump to solution
05-25-2021 08:37 PM
cwh
by
New Contributor III

Hello everyone,

I am using arcpy.management.AddGeometryAttributes to add 2 fields to feature classes (Acres and Hectares). I have to run the code twice, once for acres and once for hectares. I'm not sure if I'm reading the documentation incorrectly, but it kind of reads like I could have it create the acres and hectares fields by just running the code once.

cwh_0-1621999801340.png

My confusion is in acres/hectares are specified in the Area_Unit parameter and if it's possible to pass in multiple strings to that parameter (i.e. "Acres; Hectares") to have it create multiple fields in one go.

Anybody know if this is possible, or if I'm just hoping it will do something it won't.

Thanks!

 

Add Geometry Attributes (Data Management)—ArcGIS Pro | Documentation

0 Kudos
1 Solution

Accepted Solutions
JayantaPoddar
MVP Esteemed Contributor

You can create a Python script for the following.

Please Add fields for Area_Ac and Area_Ha as Float or Double (if not already created).

Then use Calculate Field for each field using the following expressions, as required

Expression 1 (Area_Ac):

!shape.area@acres!

Expression 2 (Area_Ha):

!shape.area@hectares!



Think Location

View solution in original post

2 Replies
JayantaPoddar
MVP Esteemed Contributor

You can create a Python script for the following.

Please Add fields for Area_Ac and Area_Ha as Float or Double (if not already created).

Then use Calculate Field for each field using the following expressions, as required

Expression 1 (Area_Ac):

!shape.area@acres!

Expression 2 (Area_Ha):

!shape.area@hectares!



Think Location
cwh
by
New Contributor III

Thanks Jayanta. Your suggestion works perfect!

0 Kudos