I am writing an application which will plot multiple GPS tracks on a virtual earth map. Each track typically contains a few thousand points. So far I am plotting a track as a series of polylines, it works but it all feels rather slow and clunky. Does anyone have any tips on how I can optimise drawing these tracks to maintain a good user experience

Many thanks for any help!


Re: Any tips for plotting multiple GPS tracks


If you have the set of points in the order they were taken have a play with puting in a 'setTimeout("ContinueYourFunction()",50);'

The idea is if you give the thread back to the UI the actual polyline has time to be shown to the user and the map still works. It gives the appearance of the line actually being animated as well. Set up a loop that continues until finished but only processes x points and the calls itslef on the timeout.

Otherwise you can play with removeing redundant points at higher zoomlevels (where they would be with a few pixels anyway) and of course only drawing lines that are within the current view.

I think the thing to keep in mind is the actual drawing of the lines is far more costly then almost any calculations you perform to optomise what is shown. Try putting a timer in place to measure how long it is actually taking, that way you will been able to see how you go. The funny thing with the timeout concept is it will actually take longer in total to render all the lines but the user experience is that it happens almost instantly becouse the UI doesn't lock up and they see something.


Re: Any tips for plotting multiple GPS tracks

Salu Vimal

Hi Jamie,

I am really stuck with the GPS plotting stuff.Could you please help me find a solution to this.
I have to plot the GPS co-ordinates of multiple vehicles at the same time on map. :-(

I am a newbie in this.Please Help.


Re: Any tips for plotting multiple GPS tracks

Duncan Garratt

It is an interesting question that you ask. The fundamental problem is that as you build up the tracks over time, hundreds or even thousands of points can be plotted, slowly bringing the map to a halt, as VE, and Google maps are not best suited to handling poly lines, or polygons with thousands of points in, an alternative approach is required if VE is to be used.

The first issue is when the map is in a live tracking mode does the whole track need to be plotted, or simply a tail, with say the last ten points of the polyline/track, indicating the trail of the tracked item, to give an indication of the direction Within the popup window on rollover a button of some sort could be included with functionality to display the whole track for that vehicle, or play back of the route, say for the last twenty-four hours or so, or other functionality as required.

Further consideration should be given to motion when retrieving locations points, and geo-fencing of stopped assets when plotting. Clearly if a tracked item is stationary you want to plot the tracked item on one occasion at the stationary point, and not hundreds, say for an overnight stop. In terms of the geo fencing of stationary tracked assets the accuracy will depend on your GPS/DGPS, your world location, atmospherics, selective availability being on/off, and a number of other factors. It would be reasonable to assume that 100-meter accuracy would prevent most errors regarding geo-fencing. Most of the time 30-50 meter accuracies could be used. For performance regarding motion geo-fencing it is better to calculate the distance with the GPRS/SMS server application, rather than the mapping application on the fly. The logic regarding motion geo-fencing can easily be written within MS SQL using TSQL.

Hope this is of help.

Duncan Garratt