I'am using leaflt-routing-machine plugin, and I need to change color of markers from blue to red, any suggestion please ?!
Asked
Active
Viewed 1,253 times
1 Answers
1
I believe that this should work just fine
var redIcon = new L.Icon({
iconUrl: 'https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-red.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41]
});
L.Routing.control({
waypoints: [
L.latLng(57.74, 11.94),
L.latLng(57.6792, 11.949)
],
collapsible: true, // hide/show panel routing
autoRoute: true, // possibility to take autoRoute
language : 'fr',
// THIS IS ESPECIALLY WHAT YOU SHOULD ADD (createMarker):
createMarker: function(i, wp, nWps) {
return L.marker(wp.latLng, {icon: redIcon });
},
// ...
}).addTo(this.map);

Soukaina EL HAYOUNI
- 331
- 4
- 18

Mohammed Housseyn Taleb
- 1,748
- 28
- 64