How to add custom property in Waypoint object RRS feed

  • Question

  • Hi Team,

    We try to implement the Direction Manager in our project and we are successfully trying it on the sample code. Please find the below code that we are referring to implement the Direction Manager. We one scenario in that we need to create multiple Direction Manager on map. And each direction Manager has its Waypoints. So after creating all the Direction Manager, it will difficult to identify which waypoint is belonged to Which Direction Manager.

    Note: We are getting all waypoints from map layers. And each Direction Manager has an individual layer.

    So we want to know about, is their way to set some custom parameters in Waypoint class object. So we can set one unique id for each Direction Manager which we show in the below code.



        <div id='printoutPanel'></div>

        <div id='myMap' style='width: 100vw; height: 100vh;'></div>

        <script type='text/javascript'>

            function loadMapScenario() {

                var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {

                    /* No need to set credentials if already passed in URL */

                    center: new Microsoft.Maps.Location(47.606209, -122.332071),

                    zoom: 12


                Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {

                    var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);

                    if (directionsManager.getAllWaypoints().length < 2) {


                        var seattleWaypoint = new Microsoft.Maps.Directions.Waypoint({ address: 'Seattle, WA' });


                        var tacomaWaypoint = new Microsoft.Maps.Directions.Waypoint({ address: 'Tacoma, WA', location: new Microsoft.Maps.Location(47.255134, -122.441650) });



                    // Insert a waypoint

                    directionsManager.addWaypoint(new Microsoft.Maps.Directions.Waypoint({ address: 'Issaquah, WA', location: new Microsoft.Maps.Location(47.530094, -122.033798), param1: "param1_value", param2: "param2_value" }), 1);          





        <script type='text/javascript' src='[Bing_Map_Key]&callback=loadMapScenario' async defer></script>




    • Edited by vikas dugi Tuesday, May 5, 2020 2:47 PM
    Tuesday, May 5, 2020 2:46 PM

All replies