I created a new point layer in ArcGIS online and added it to a map. I want to automatically calculate the MSL vertical elevation using arcade and have done so before on other layers but for some reason the calculation doesnt work for this layer and I dont understand why. Below is a snapshot of the equation with the error message. When this work it normally displays a 0
Solved! Go to Solution.
I figured it out. For some reason I just needed to have a single feature created and on that map and then the calculations worked. It didnt seem to want to work without a feature existing.
You checked that all features have a Z value? possibly an if/else to catch exceptions would be good practice.
Its a brand new layer made in ArcGIS Online and selected the geometry and Z value options. The URL shows it has both enabled
Seems odd, but I agree with @DavidPike that some debugging would be helpful.
Try assigning geometry($feature) to a variable and print to the Console, like
var geom = Geometry($feature)
Console(geom, geom['z'])
Understanding what's going into the rounding function will help explain why it's not returning what we want.
You should be able to use the code as written. The result will show up in the Console tab of the expression builder.
I figured it out. For some reason I just needed to have a single feature created and on that map and then the calculations worked. It didnt seem to want to work without a feature existing.
Oh! Yeah, the field calculator validates the expression with a sample record from the table, and that sometimes gets weird if there are no records, or if it's validating against some outlier.