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

4 posts, 1 answers
  1. Andre
    Andre avatar
    14 posts
    Member since:
    Jun 2014

    Posted 19 Jun 2014 Link to this post

    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?
  2. Andre
    Andre avatar
    14 posts
    Member since:
    Jun 2014

    Posted 19 Jun 2014 in reply to Andre Link to this post

    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 #"
                                }
                            }]
                        });
  3. Kendo UI is VS 2017 Ready
  4. Answer
    T. Tsonev
    Admin
    T. Tsonev avatar
    2771 posts

    Posted 20 Jun 2014 Link to this post

    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!
     
  5. Andre
    Andre avatar
    14 posts
    Member since:
    Jun 2014

    Posted 20 Jun 2014 in reply to T. Tsonev Link to this post

    Thanks, got it working on my end!

    Regards,

    Andre
Back to Top
Kendo UI is VS 2017 Ready