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

How do I update the coordinates of a marker in realtime?

3 Answers 245 Views
Map
This is a migrated thread and some comments may be shown as answers.
Andre
Top achievements
Rank 1
Andre asked on 19 Jun 2014, 09:11 PM
I'm making an ajax call every x number of seconds to get lat/lon coordinates from a server and I would like to use this data to update the position of a marker in realtime. I only have a single marker on the map, so how would I access that marker and move it as the coordinates change?

I currently have something like this:
$("#map").data("kendoMap").markers.items[0].location([0, 0])

But its not working for me, is there a method I can call?

3 Answers, 1 is accepted

Sort by
0
Andre
Top achievements
Rank 1
answered on 19 Jun 2014, 10:54 PM
Just a further update to this post:

Here's the initialization code:

$("#map").kendoMap({
                        center: [51.505, -0.09],
                        zoom: 3,
                        layers: [{
                            type: "bing",
                            // IMPORTANT: This key is locked to demos.telerik.com
                            // Please replace with your own Bing Key
                            key: "somekey"
                        }],
                        markers: [{
                            location: [30.268107, -97.744821],
                            shape: "pinTarget",
                            tooltip: {
                                template: "Lon:#= location.lng #,<br /> Lat:#= location.lat #"
                            }
                        }]
                    });
0
Accepted
T. Tsonev
Telerik team
answered on 20 Jun 2014, 03:07 PM
Hi,

I don't see anything wrong with your approach. I've tried it on this test page and it appears to work:
http://trykendoui.telerik.com/uqOJ/2

Do you get any error messages in the console?

We'll add documentation for these methods as soon as possible.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Andre
Top achievements
Rank 1
answered on 20 Jun 2014, 04:15 PM
Thanks, got it working on my end!

Regards,

Andre
Tags
Map
Asked by
Andre
Top achievements
Rank 1
Answers by
Andre
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or