Summary
In ArcGIS Pro, the Calculate Field tool can be used to convert values in decimal feet into feet and inches and populate the values into a new text field. A clearer representation of the units can be useful for labeling purposes. The workflow in this article describes how to achieve this by creating a function containing the conversion formula and splitting decimal feet into two different units.
Procedure
- Create a new text field to populate the output in the feature layer in ArcGIS Pro.
- In the Contents pane, right-click the feature layer and click Attribute Table. The example used in this workflow is the poi layer.
- Add a new text field to the attribute table. Refer to ArcGIS Pro: Create and manage fields for instructions to do so. The new text field in this workflow is named Label.
The image below shows the poi attribute table with the new text field.
- Convert the decimal feet values into feet and inches using the Calculate Field tool.
- On the top ribbon, click Analysis > Tools.
- In the Geoprocessing pane, search for the Calculate Field tool.
- Under Parameters, select the layer for Input Table.
- Select the field created in Step 1 for Field Name (Existing or New).
- Select Python 3. For Expression Type.
- In the Expression text box above the Code Block box, enter the following script:
convert(!<field name>!)
- In the Code Block box, enter the following script:.
def convert (number):
feet = int(number)
inches = (abs(number)-feet)*12
result = str(feet)+"'" + str(int(round(inches, 0))) + "''"
return result
- Validate the expression and click Run.
The image below shows the values in the new units populated in the Label column.