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