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!
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
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
Abi,
Thanks for keeping me updated! It's great that things are getting back on track!
Have a lovely weekend,
Lingtao
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.
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
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.
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
Hi Xander,
I faced a similar situation. When I test this expression in Arcade Calculator "round(Area(geometry($feature), 'hectares'),2)" the result is "The input unit and the spatial reference unit are not of the same unit type i.e Linear vs.Angular".
What Expression should I add in order to calculate the area?