Select to view content in your preferred language

Dynamic animation of graphic's position by extrapolation

636
3
12-13-2021 02:00 AM
Tone
by
Emerging Contributor

Hi,

I need to animate many graphics, mostly representing ships, knowing their kinematics (position, course, and speed). Course is defined by an angle in degrees, 0 being north, 90 is east, and so on, regardless of the ship's position. The map is 2D, the course of a ship is a straight line. Kinematics will be updated at some point during runtime.

What I'm gonna need is some way to extrapolate their positions over time, and render the new positions.

I've come across this example and  this PDF by @MarkBaird and Vijay Gandhi which are very helpful for the rendering part.

For the extrapolation part, I'm wondering if their is anything built-in for this kind of usage, or if I'm gonna need to set up a Thread that will calculate the new positions of the ships for every frame.

 

How would you do it ?

0 Kudos
3 Replies
MarkBaird
Esri Regular Contributor

Hi @Tone 

I've seen a few apps like the one you describe and a wrote a blog post on the subject a few months ago.  It is far more up to date than the PDF you linked to which is from 2014.

There is a git repository which has a working app showing an example of how this is done too.  In this case it was a simulation of vehicles based on route data in csv files.  It may follow a similar pattern to what you need to implement.

Let me know if this helps.

Mark

Tone
by
Emerging Contributor

Hi @MarkBaird 

Thank you for these informations. I've managed to code a workaround, and I was wondering, how did you stress test the app in your blog post ? My app only seems to refresh my graphic's positions once every second, regardless of how many graphics I add.

I know for sure that my update thread runs more than once per second, but it seems like it is the ArcGIS API that is preventing me from going beyond that limit.

0 Kudos
MarkBaird
Esri Regular Contributor

In the app in in my git repository I'm refreshing 5000 graphics every 20ms.  I've managed to get it up to 50000 before I started to see a drop in performance.

If you pull the source code for the demo app and run it, you will see it performs quite well.

Something is wrong if you can't refresh every second.  

Have a close look at how I've got this working and see if this can be applied to your own app.  You can definitely improve on the 1second refresh rate you have at the moment.

If you have some code you can share I can take a look at it.

 

0 Kudos