Field area calculation using arcade function is not giving me the right result.

533
7
07-12-2019 08:53 AM
Highlighted
Occasional Contributor

Hello GIS friends,

I am trying to run field calculation for area with arcade function, (round(Area($feature, 'acres'),1), but it is giving me only '0's all the way. The calculation runs with no error but the result is populated with '0' for all the rows. What am I doing wrong?

Thank you friends and happy Friday!

Reply
0 Kudos
7 Replies
Highlighted
Esri Contributor

Hello Abi,

Happy Friday! The Arcade expression looks good. What is the type of your target field? We might want to use Double here. The area values will be rounded off to the nearest whole number if the field is Integer.

Keep me updated 

Highlighted
Occasional Contributor

Hello Lingtao,

Thank you for your suggestion. The field is double. I again ran the rule and checked the data and now it seems to run normally.

Thank you so much for your input.

I am just coming back from a meeting and had not had a chance to respond to your message for that I am sorry.

Thank you again.

Abi

Highlighted
Esri Contributor

Abi,

Thanks for keeping me updated! It's great that things are getting back on track!

Have a lovely weekend,

Lingtao

Highlighted
New Contributor

Hello Abi,

The script looks correct, however there maybe a bug and the calculator is not realising that the geometry is needed for each feature, and so is not fetching it.

You could try: 

(round(Area(geometry($feature), 'acres'),1)

This extra big of logic may make the field calculator detect the use of feature geometry.

Highlighted
Occasional Contributor

Hey David,

Thank you for it is working now. I reran it and it looks good. I will save your arcade function for my future use as well.

Abi

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Abi Dhakal ,

Your formula and the one provided by David Bayer  are both correct in case you have projected data. If your data is using a geographic coordinate system like GCS WGS 1984, it is very likely that all records will return 0. You will have to project the data to avoid this behavior. 

Highlighted
Occasional Contributor

Thank you Xander. I have a projected coordinate system.

I do not know what I was doing wrong but it is working now. I really appreciate your input.

Thank you again.

Abi