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:
WGS_1984_Web_Mercator_Auxiliary_Sphere
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?