Select to view content in your preferred language

Auto Calculate area of polygon in attribute table when creating a new polygon in a feature class

196
2
Jump to solution
4 weeks ago
MarcyC
by
New Contributor

Hello,

I am currently opening my web maps in ArcGIS Pro in order to auto calculate Acreage.

 

This is my current work flow:

  1. • Open Attribute Table
    o Click on Fields List (right click on a field heading and click on “Fields” in the pop-up
    • Scroll to bottom to add a new field
    o Fill out Field Name and Alias as “Acre”
    o Change Data Type to “Double” and Number Format to “Numeric”
     In the Number Format Pop-up that appears change decimal places to 2
    • Save (in the ribbon at top)
    • Back in Attribute table
    o Right click – select calculate geometry
     Property: Area (geodesic)
     Area Unit: US Survey Acres
     Coordinate System: (click on the globe)
    • Projected Coordinate System
    o UTM
     North America
    • “NAD1983”
    o Zone10N

However, when polygons are added via AGOL or Field maps the field does not auto calculate. Is there a way to set this up so that when a new polygon is made there is a field that automatically shows the acreage. I would also like to do this with a line layer to calculate length.

 

Thank you, I would greatly appreciate any insight!

 

 

 

0 Kudos
2 Solutions

Accepted Solutions
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Hi @MarcyC,

If you are using field maps in agol then you would simply need to do a calculated expression for that field. Which would look like the steps below:

RPGIS_0-1743532121904.png

RPGIS_1-1743532248426.png

Create the new arcade expression to look like the one below

var edit = $editcontext.editType
var ShapeArea = $feature.Shape__Area
var CalcArea = 0
if( edit == 'INSERT'){
  //if area is in sq ft
  CalcArea = ShapeArea*0.0000229569
  //if area is in sq meters
  CalcArea = ShapeArea*0.00024711
  }
return CalcArea

For line lengths you can use the same approach.

View solution in original post

0 Kudos
MarcyC
by
New Contributor

Thanks RPGIS! If anyone looks at this in the future here was my work flow:

 

1. Create a field named “Acres”
2. In Field Maps Designer
a. Select layer
b. Select “Acres” Field > scroll to the bottom of the Properties pane
c. Select “ New Expression” > add Arcade expression:
// Calculate the area using the geometry
var geom = Geometry($feature)
if (IsEmpty(geom)) {
return null
} else {
return Round(AreaGeodetic($feature, 'acres'), 3)
}
d. Click the drop down arrow next to the save icon to “Save to layer” this will save the expression and apply to all the maps this layer is in

 

I also like this blog post where I got the arcade expression: https://www.esri.com/arcgis-blog/products/field-maps/field-mobility/common-calculated-expressions-fo...

View solution in original post

2 Replies
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Hi @MarcyC,

If you are using field maps in agol then you would simply need to do a calculated expression for that field. Which would look like the steps below:

RPGIS_0-1743532121904.png

RPGIS_1-1743532248426.png

Create the new arcade expression to look like the one below

var edit = $editcontext.editType
var ShapeArea = $feature.Shape__Area
var CalcArea = 0
if( edit == 'INSERT'){
  //if area is in sq ft
  CalcArea = ShapeArea*0.0000229569
  //if area is in sq meters
  CalcArea = ShapeArea*0.00024711
  }
return CalcArea

For line lengths you can use the same approach.

0 Kudos
MarcyC
by
New Contributor

Thanks RPGIS! If anyone looks at this in the future here was my work flow:

 

1. Create a field named “Acres”
2. In Field Maps Designer
a. Select layer
b. Select “Acres” Field > scroll to the bottom of the Properties pane
c. Select “ New Expression” > add Arcade expression:
// Calculate the area using the geometry
var geom = Geometry($feature)
if (IsEmpty(geom)) {
return null
} else {
return Round(AreaGeodetic($feature, 'acres'), 3)
}
d. Click the drop down arrow next to the save icon to “Save to layer” this will save the expression and apply to all the maps this layer is in

 

I also like this blog post where I got the arcade expression: https://www.esri.com/arcgis-blog/products/field-maps/field-mobility/common-calculated-expressions-fo...