Area, Arcade Function calcuting area is way off from actual area

11-13-2020 04:29 PM
Regular Contributor

I have a simple web map with one polygon layer in it. I wanted to add a field to the popup window to show area in hectares for this layer. I use the following Arcade expression:


var hecs = Area($feature, 'hectares')
return round(hecs, 2)



The expression runs successfully. When I go to look at the value for each feature in the layer from the popup window, the areas are way off. I attached an image. Within the image, you will see 3 fields:

  • FEATURE_AREA_SQM: This is our system generated area field, much like Shape_Area. It calculates, on the fly, the area of each feature in square metres.
  • AREA_IN_HECTARES: Same as above, but calcultaes hectares as opposed to square metres
  • Hectares: This is the field I created using the arcade expression above. Notice how off it is compared to the other field values.

I did a further check to see if our system values were calculating correctly by making a copy of the data in ArcMap, adding a field for Hectares and Calculated geometry for hectares. Our system values are correct.

I would have thought that this could be a projection issue, but the values are so grossly off, I don't think that's the issue. But, for the record, the layer is a hosted feature layer that was added to ArcGIS online in the native projection that AGOL uses:

WKID: 3857

Finally, I tested on some other layers and am getting the same issue. I tried different area values (i.e. square metres, square kilometres) and they are all way off.

Can anyone suggest what is wrong with these areas?

Tags (3)
0 Kudos
3 Replies
MVP Frequent Contributor

Your table values are correct.

Web mercator is not a projection to be used for anything geometry related

FAQ: Why are my map, distance and area measurements wrong when using WGS 1984 Web Mercator? 

... sort of retired...
Regular Contributor

I think you were on the right track about the projection. Our experience with Arcade's area function has been that regardless of the projection of the data itself, the output will depend on the web map's projection. Generally, this is the Web Mercator, and can yield very different area measurements depending on your latitude.

What you may want to look into is the AreaGeodetic function. Function reference here.

I've attached a couple of images. One shows by color the Area to AreaGeodetic ratio, the other gives the actual values as labels.

- Josh Carlson
Kendall County GIS
Esri Esteemed Contributor

Hi @MikeMacRae ,


In addition to what @DanPatterson and @jcarlson have stated, Arcade will work with the geometry based on the detail of the geometry in the current viewscale. 

"Note that geometries fetched from feature services, especially polylines and polygons, are generalized according to the view's scale resolution. Be aware that using a feature's geometry (i.e. $feature) as input to any geometry function will yield results only as precise as the view scale. Therefore, results returned from geometry operations in the visualization and labeling profiles may be different at each scale level. Use these functions at your discretion within these contexts."