3
votes

I'm using the Mapbox directions API and leaflet to create an interactive map.

When invoking the directions functionality, everything works great and Mapbox sets a marker for my origin and destination.

By default, it uses a generic marker with A and B respectively. I can't find any documentation on configuring the marker it uses, does anyone have any insights, examples, or suggestions?

Thank you!

1

1 Answers

0
votes

The documentation seems to focus on featureLayers to make custom pin. I found that markers with custom icon do the job better.

Here is the way I do it:

blueIcon = new L.icon({ iconUrl: '/img/Bo6.png', iconSize: [75, 75], // size of the icon popupAnchor: [300, -125] });

movingMarker = new L.marker([51.5, -54.11], { "title": "Felix in Space", "description": "1718 14th St NW, Washington, DC", className: "event-popup-box", icon: blueIcon });

movingMarker.addTo(themap);