This is a migrated thread and some comments may be shown as answers.

Drawing Traceline

3 Answers 19 Views
Map
This is a migrated thread and some comments may be shown as answers.
Vincent
Top achievements
Rank 1
Vincent asked on 23 Sep 2015, 02:12 PM

 Hi,

I have marker point that updates it's position periodically on the map. If i wanted to draw a traceline on the map to keep track of the path that the marker point has moved, what would be the best way of doing it without slowing down the rendering of the details on the map?

 

3 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 25 Sep 2015, 01:53 PM
Hello Vincent,

You can achieve your requirement by using the map's VisualizationLayer and its map shape data objects to draw the traceline and the marker. For example, you can use the PolylineData object to draw the traceline and when the marker's position is updated you can add new Location in the Points collection of the polyline. for your convenience I prepared a sample project demonstrating this approach. Please give it a try and let me know if it works for you.

Regards,
Martin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Vincent
Top achievements
Rank 1
answered on 17 Dec 2015, 06:23 AM

Hi Martin,

the example you provided was really helpful thank you, however I come across a problem when I try to clear the LocationCollection (Contains 1 hour of data points that's roughly 72k worth of location) it took me roughly around 4 to 5 seconds before the layer clears it all off. Any recommendation how I can clear this fast?

 a sample code

 visualizationLayer.Visibility = false;

visualizationLayer.Points.RemoveAll();

visualizationLayer.Layer.Items.Clear();

 

 

0
Accepted
Martin Ivanov
Telerik team
answered on 21 Dec 2015, 09:30 AM
Hello Vincent,

Removing an item from the Points collection of a PlylineData object executes a logic in code which requires additional computing time. This is why clearing the collection takes several seconds. To improve the removing operation on your side you can use the Clear() method of the Points collection instead of RemoveAll().
visualizationLayer.Points.Clear();

Please try this and let me know if it works for you.

Regards,
Martin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Map
Asked by
Vincent
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Vincent
Top achievements
Rank 1
Share this question
or