[英]How to add dynamic markers in mapbox?
i want to show dynamic markers in mapbox js. 我想在mapbox js中显示动态标记。 i created the dynamic markers in the dataset.
我在数据集中创建了动态标记。 Now.
现在。 i am confused how to display them.
我很困惑如何显示它们。 i want result like this.
我想要这样的结果。 https://screenshots.firefox.com/yW9nHlICwVAbDLeF/api.mapbox.com
https://screenshots.firefox.com/yW9nHlICwVAbDLeF/api.mapbox.com
My current result is. 我目前的结果是。 https://screenshots.firefox.com/K1a5WVQHlxtFSIZY/null
https://screenshots.firefox.com/K1a5WVQHlxtFSIZY/null
Thanks in advance 提前致谢
This is very easy to accomplish. 这很容易实现。 I have produced a code sample for you.
我为您制作了一个代码示例。
I suggest taking each concept do a little reading arond it to understand how it works. 我建议您对每个概念进行一些阅读,以了解它是如何工作的。
Mapbox JS has some excellent documentation to help you. Mapbox JS有一些出色的文档可以为您提供帮助。 https://www.mapbox.com/help/markers-js/#getting-started
https://www.mapbox.com/help/markers-js/#getting-started
L.mapbox.accessToken = 'pk.eyJ1IjoiZGF2aWRiYXR0eSIsImEiOiJjajBqc2hqZ3YwMDN5MndvbDUxaDhoMDV6In0.w7sfrB5JeCH92sY-l0TQSg'; var mapLeaflet = L.mapbox.map('map-leaflet', 'mapbox.light') .setView([53.801277, -1.548567],10); L.marker([53.801277, -1.54856]).addTo(mapLeaflet); L.marker([53.901277, -1.54856]).addTo(mapLeaflet); mapLeaflet.scrollWheelZoom.disable();
body { margin: 0; padding :0; } .map { position: absolute; top: 0; bottom: 0; width: 100%; }
<link href="https://api.mapbox.com/mapbox.js/v3.0.1/mapbox.css" rel="stylesheet"/> <script src="https://api.mapbox.com/mapbox.js/v3.0.1/mapbox.js"></script> <div id='map-leaflet' class='map'> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.