Tracking of a position is displayed with shocking effects

456
1
06-08-2017 02:48 AM
Jeroenvan_Onzen
New Contributor

Hi all,

We want to constantly track a single vehicle. We found the option to track, like this:  

https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=widgets-track

However, this isn't displayed like a fluent movement. How can we set the current implementation to get a smooth line, like it's behaving on my cell phone. 

With regards,

Jeroen van Onzen

0 Kudos
1 Reply
ThomasSolow
Occasional Contributor III

When you say smooth line, do you mean the graphic representing the vehicle should move in a smooth line, or the camera following it?  To get the camera to move smoothly, you can play with the goTo function in that sample.  Adding a second parameter of { duration: 1500 } to goTo makes it look pretty smooth to me.

If you're talking about the graphic, the main variables are how frequently location updates are occurring, how fast the thing being tracked is moving, and how far the user is zoomed in.  If there's an update every 100 ms and it's a car, it's going to look pretty smooth.

If updates aren't going to be that frequent, and it's absolutely necessary that the track be smooth, you could interpolate the movement between the last known point and the current known point.  This would be artificial in that the position of the graphic would not reflect the currently up-to-date location of the thing being tracked.

I would approach this by densifying a polyline between the last known position and current known position and moving the graphic along that polyline.  You'll have to handle a situation where another update comes in before the graphic has reached the currently known location.