Issues with Polylines with large number of points

In our application, I'm mapping the path of a moving object by drawing a line to trace its path as I receive position updates from that object. My issue is that, after getting a few thousand points(positions) in the line, Chrome crashes.

In my current implementation, I'm just grabbing that specific line from the line collection and then pushing a new point to the end of the positions array.

Is there another way I should be doing this? I also considered/tested adding numerous lines to the collection instead of adding a large number of points. That didn't seem to help much.

I noticed in another thread that there was a suggestion to use a point geometry to render a large number of points. Should I try the same thing with a polyline geometry?

Actually, I guess another question would be... can you update/add positions to a geometry like that? I haven't used geometries much so I hadn't examined what all was possible with them. Looking at the object though, I don't see a clearly labeled array that I can push new positions to.


Use a new PolylineCollection for every 512-2048 points you receive. Tweak that range as needed for your data. This will reduce the overhead of adding points to a polyline and keep the total number of polylines/collections down to something reasonable.