Hello,
I'm trying to retrieve the length of a path generated by the My Location widget in Experience Builder (standard edition) and report it in a Text widget.
Currently, using statistics within the dynamic content section of the Text widget, I am able to retrieve the Count of locations captured and multiply that by the streaming distance specified, but this isn't overly accurate.
If there's a way to retrieve the path length directly from the geometry using Arcade, I'd love to hear how.
Alternatively, I wouldn't mind being able to retrieve the average speed and start/end time from which I could calculate distance. I appear to have access to these properties in the dynamic content expression window but I cannot perform any calculations with them and the DateDiff function isn't available.
Or similarly, if I could retrieve the lats and longs from each location collected, I think I could also work with that and calculate distance using Arcade.
None of the Arcade Expressions I've attempted to use return any useful information and I can't find much in the way of documentation/examples.
When I return the loadedfeatures or selectedfeatures properties of $datasources in the expression builder it shows me that they return FeatureSets with the following fields: OBJECTID, LineID, location_timestamp, Longitude, Latitude, altitude, Orientation, speed, Accuracy (which is what I see in the popup when clicking on a recorded feature)
But if I return the loadedfields property, it only shows me 0: OBJECTID
I see that $datasources has a layer property that is also supposed to return a FeatureSet but I can't seem to get anywhere with it either.
I see that $datasources has a queryParams dictionary that contains some properties e.g. 'outfields', 'outStatistics', 'returnDistinctValues', 'returnGeometry' that may be helpful but it seems like queryParams is immutable so I'm not sure how to update it.
Hopefully I'm making sense. Any help or references to other resources would be much appreciated!
Thanks