How to set numbers and tooltip to waypoint markers in leaflet routing machine?

37 Views Asked by At

I'm trying to create a leaflet routing machine route with multiple waypoints.

var map = L.map('map');

    L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }).addTo(map);

    L.Routing.control({
        waypoints: [
            L.latLng(42.88308, -78.87677),
            L.latLng(42.88420, -78.87695),
            L.latLng(43.089758,-78.969168),
            L.latLng(43.88308, -78.87677)
        ],
        lineOptions: {
            styles: [{color: 'blue', opacity: 1, weight: 5}]
        },
        routeWhileDragging: true
    }).addTo(map);

i would like to get 2 more things in the map

a) For each way point the marker should display a number like 1,2,3,4.. b) For each way point the marker should display a tooltip with the number like 'this is number 1'

Any suggestions please.

0

There are 0 best solutions below