none
Bing map multiple pushpin

    Question

  • Hello,

    I'm a new bing map api user and I'm searching a way to put multiple pins on a bing map. I have access to an array containing adresses so I need to geocode these adresses and put a pin on the location. I share my code, it's working with one pushpin but not with multiples.... 

    I'm a beginner with bing map api I just use samples on the doc for my website 

    Thank you for your help

    function addAllPins(map, Adresse){
     for (j = 0; j < Adresse.length; j++){
         Microsoft.Maps.loadModule('Microsoft.Maps.Search', function () {
        searchManager = new Microsoft.Maps.Search.SearchManager(map);
        var searchRequest = {
                where: Adresse[j],
                callback: function (r) {
                    if (r && r.results && r.results.length > 0) {
                            pin = new Microsoft.Maps.Pushpin(r.results[0].location);
                        }
                        map.entities.push(pin);
                    }
                }
            searchManager.geocode(searchRequest);
           });
        }
    }


    Thursday, April 4, 2019 2:22 PM

All replies