Hi all,
looking for some advice on the DistanceGeodetic function.
I have a fieldmaps project with point data being gathered against a set of polygons. I would like to add a distance value to each point relative to the polygons.
The Distance function seems to return erroneous planar distances, I'm assuming this because all of the layers and web map are in Web Mercator and Distance works in planar.
DistanceGeodetic is suggested as a way around this but only works between two points so I had planned to use this with NearestCoordinate generated between the point and polygon as an intermediary value, then using the result of this as the point to measure distance to the feature. This evaluates ok in the FieldMaps designer but in the app I am getting a failed to calculate error.
Testing just the DistanceGeodetic function on its own using two point datasets this also fails in the app even though it evaluates in the designer ok. Test script:
// Test points is a single point a couple of km from the single point in the feature dataset
var test_points = FeatureSetByName($map, 'test_measure')
var test_point = First(test_points)
return DistanceGeodetic($feature, test_point, 'meters')
Checking the logs from FieldMaps for both failures the error message is along the lines of:
Expression failed to evaluate:\nName: expr/new-expression\nError: java.util.concurrent.ExecutionException: com.esri.arcgisruntime.ArcGISRuntimeException: Arcade expression is invalid.: Arcade evaluation error. Evaluation_error_code::unknown_function
As stated above these expressions are evaluating ok in the designer but not in the app.
I’ve made sure I’m using the latest version of the FieldMaps app and tested with a simplified map project containing only the point and polygon layers.
Any suggestions would be appreciated.
Thanks
Charles
This is a similar workflow using ArcGIS Pro but also utilises Arcade, it might be work implementing some suggestions for this documentation
The Shape_Length field in a feature layer’s attribute table displays inaccurate values
I wonder if its coming back as a string. Try wrapping Number() around test_point. Just a guess.
@CharlesHutchinson1 I was able to reproduce this issue in the current release of Field Maps and it does look like a bug. The good news is, it will be fixed in the updated version of Field Maps slated for release in Q1 next year.
The end of this blog post has a bit more information about the big Field Maps update that's coming next year and it has instructions on how to sign up to test it if you'd like to verify your arcade expression will work in the new version: https://www.esri.com/arcgis-blog/products/field-maps/field-mobility/whats-new-in-arcgis-field-maps-j....