I am struggling with my first attempt at some track functions --
https://developers.arcgis.com/arcade/function-reference/track_functions/
Specifically, I want to look at the last 10 transactions in the Track (the last five minutes of activity) and determine the distance traveled between the starting and ending transactions in the window. So I wrote two arcade expressions to populate two new fields in the output schema.
First I get the TrackWindow looking back -10 to current 0.
Then get the number of reports for the Track.
If we get less than Ten return -9999 for downstream logic.
If we got ten then return the TrackSpeedAt(0) over Window, or Return the TrackDistanceAt[10] over the Window. But I am not at all sure that/how these functions know I am looking at the 10 Tracks from the TrackWindow command.
However, the arcade debugger does not seem to be much help, and debugging this downstream, I never seem to get anything other than the -9999.
Any ideas, explanations for something I am missing, or corrections to my logic would be appreciated.
// Get the last ten reports, 5 minuites worth, assuming 2 per minuite
var tracks = TrackWindow(-10, 0);
// Count the number of elements in the array
var numFeatures = count(tracks);
// if the number of features < 10 retun Not Idle.numFeatures
// TrackSpeed is in meters per second.
if (numFeatures < 10 ) {
return(-9999)
} else {
return(TrackSpeedAt(0));
}
The other is
// Get the last ten reports, 5 minuites worth, assuming 2 per minuite
var tracks = TrackWindow(-10, 0);
// Count the number of elements in the array
var numFeatures = count(tracks);
// Get the distance traveled over the last ten reports, Meters
var distanceWindow = TrackDistanceWindow(-10, 0);
// if the number of features < 10 retun Not Idle.numFeatures
// TrackDistance in meters second.
if (numFeatures < 10 ) {
return(-9999)
} else {
return(distanceWindow[10]);
}
Solved! Go to Solution.
Now that you point it out I see that --
But since in my RTA reports come in one every thirty seconds or two per minute, and I need to know if something has not moved for five minutes (2*5) or 10 transactions. How would you do this with the Track functions?
Am I setting a Window with this command for the other functions or are they independent unless they accept the resulting array? Are the other Track functions also restricted this way by the -5 limitation?
TIA --
Hi Jeff- Previous track values can be retrieved up to 5 previous features (-5). This means that numFeatures will always be less than 10 and will always return a -999 value.
This limitation is noted in https://doc.arcgis.com/en/velocity/analyze/use-track-functions.htm > 'Usage Notes' section.
-Joanna
Now that you point it out I see that --
But since in my RTA reports come in one every thirty seconds or two per minute, and I need to know if something has not moved for five minutes (2*5) or 10 transactions. How would you do this with the Track functions?
Am I setting a Window with this command for the other functions or are they independent unless they accept the resulting array? Are the other Track functions also restricted this way by the -5 limitation?
TIA --