How to add map marker with Script

3 posts, 0 answers
  1. Steve
    Steve avatar
    4 posts
    Member since:
    Nov 2012

    Posted 18 Aug Link to this post

    I have a map that a user will utilize in order to mark their position. I use geolocation and Bing layer to give them a good start. I want them to click on the map, have it recenter to the point they click, remove the existing marker, then create a new one where the map is centered.


    function onClick(e) {
                var resultArray = e.location.toString().split(',');
                $('#map').data("kendoMap").center([parseFloat(resultArray[0]), parseFloat(resultArray[1])]);
                $('#map').data("kendoMap").markers.add([parseFloat(resultArray[0]), parseFloat(resultArray[1])]);

    The function above centers the map, removes the previous marker, and does not give an error on the ADD.  However, the new marker doesn't show up.

    Help please.

  2. Steve
    Steve avatar
    4 posts
    Member since:
    Nov 2012

    Posted 19 Aug Link to this post

    Got an answer on SO:

    function createMap(Lat, Long) {
                center: [Lat, Long],
                zoom: 17,
                layers: [{
                    type: "bing",
                    imagerySet: "aerialWithLabels",
                    key: "###MYKEY###"
                markers: [{
                    location: [Lat, Long],
                    shape: "pinTarget",
                    tooltip: {
                        content: "You are Here!!"
                click: onClick,
                panEnd: onPanEnd
    function onClick(e) {
            var map = $("#map").data("kendoMap");
            var loc = map.eventToLocation(e);
            map.markers.add({ location: loc });
  3. UI for ASP.NET AJAX banner
  4. Patrick
    Patrick avatar
    151 posts

    Posted 19 Aug Link to this post

    Hi Steve,

    Glad you found a solution!  

    Telerik by Progress
    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
Back to Top