Hey guys I know that we can set labels for the markers using the map.add layer method. But is there any possibility of setting the label for a Mapbox marker in the following method ( eg Set label or something)? Or is there any possibility that I can use a javascript function to attach a label to this marker? Thanks a lot for your time.
var mymarker= new mapboxgl.Marker(el)
.setLngLat(marker.geometry.coordinates)
.setPopup(
new mapboxgl.Popup({ offset: 25 }) // add popups
.setHTML('</h3><p>' + marker.properties.description + '</p>' )
).addTo(map);
You're confusing Popups , Markers and Symbol layers .
Suggest you read the documentation closely to understand how each works.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.