Quantcast
Channel: Leaflet routing control change marker icon - Geographic Information Systems Stack Exchange
Viewing all articles
Browse latest Browse all 4

Leaflet routing control change marker icon

$
0
0

I am looking for a way to show different markers for the two waypoint that are initialized by leaflet.routing.control.

This is what i tried:

var controlWalk = L.Routing.control({        lineOptions: {           styles: [               {color: 'white', opacity: 0.9, weight: 9},               {color: '#FC8428', opacity: 1, weight: 3}           ]        },        waypoints: [            start,            goal        ],        createMarker: function (i, start, n){             //for (i = 0; waypoint.length; i++){            return L.marker (start.latLng, {                    draggable: true,                    bounceOnAdd: false,                    bounceOnAddOptions: {                        duration: 1000,                        height: 800,                         function(){                            (bindPopup(myPopup).openOn(map))                        }                    },                    icon: WalkMarker            }).bindPopup(myPopup).openPopup();

The result of this are two markers with the same icon.

How do I change the function to solve the problem?

There is also another behavior that i dont understand: when the icon appear, the popups don't. Only by clicking the marker they appear.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images