How to add a simple Marker in Mapbox GL?
Asked Answered
S

1

7

Since the Mapbox GL documentation doesn't talk about anything regarding adding simple markers to LngLat coordinates, and really only has documentation on how to add custom markers, I was hoping someone could tell me how you're supposed to get Mapbox-gl.js to actually add a marker to passed LngLat coords.

Syrup answered 29/7, 2016 at 21:31 Comment(1)
Possible duplicate of How to add a marker to a MapBox GL JS map?Monotype
S
6

Good news! In the newest release of mapbox-gl-js (v0.21.0) a new Marker class was added that provides the functionality you're looking for:

https://docs.mapbox.com/mapbox-gl-js/api/#marker

https://docs.mapbox.com/mapbox-gl-js/example/custom-marker-icons/

Sonometer answered 4/8, 2016 at 21:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.