0

Is it possible to have multiple pushpin icons in Bing-maps DirectionsManager?

I have this code which works and draws the route on the map:

    Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {
        directionsManager = new Microsoft.Maps.Directions.DirectionsManager(myMap);

        for (var i = 0; i < pinHandlers.length; i++) {

            var title = 'test location';
            var ph = pinHandlers[i];

            var wp = new Microsoft.Maps.Directions.Waypoint({
                address: title,
                location: new Microsoft.Maps.Location(
                    ph.loc.latitude,
                    ph.loc.longitude
                )
            });
            directionsManager.addWaypoint(wp);
        }

        // This sets the icon for all the points created above
        directionsManager.setRenderOptions({
            itineraryContainer: '#directionsItinerary',
            waypointPushpinOptions: {
                icon: '/assets/images/map-markers/delivery.PNG'
            }
        });
        directionsManager.calculateDirections();
    });

By the looks of the API, I can only change the push pin for all points within the route. I'd like to use different icons for each point if that is possible.

Noobie3001
  • 1,230
  • 18
  • 31

1 Answers1

0

Yes! You can have multiple icon styles. Take a look at https://bingmapsv8samples.azurewebsites.net/#Fully%20Custom%20Waypoint%20Pushpins

It shows how to add different pins at different waypoints. Note that this GITHUB is created and maintained by Microsoft so please do report any issues you have with the repository there.