如何更改Mapbox标记(使用directionjs时)?如何使用directionsjs更改Mapbox的标记?它显示A和B标记
它显示A和B标记。
我试着编辑标记,但失去方向。
var x= L.marker([51.508245, -0.087700], {
icon: L.mapbox.marker.icon({
'marker-size': 'large',
'marker-icon': 'monument',
'marker-color': '#fa0'
})
}).addTo(map);
// Set the origin and destination for the direction and call the routing service
directions.setOrigin(L.latLng(x));
directions.setDestination(L.latLng(51.508112, -0.075949));
directions.query();
var directionsLayer = L.mapbox.directions.layer(directions).addTo(map);
var directionsRoutesControl = L.mapbox.directions.routesControl('routes', directions)
.addTo(map);
var directionsLayer = L.mapbox.directions.layer(directions, {readonly: true}).addTo(map);
以上是我试过的,但它打破了方向。我正在寻找一种方法来改变A和B.
的jsfiddle的图标:https://jsfiddle.net/x48qrca8/1/
试过了 - 我可以更改标记颜色,但不能更改图标。捣鼓更新的图标URL - http://jsfiddle.net/pq2wv4j9/4/ - 图标显示为灰色。 –
你在他们的网站上看过[这个例子](https://www.mapbox.com/help/markers/#marker-image)吗?这可能有帮助。 – BDD
太棒了。这工作。附加问题(以便我不打开新线程):如何隐藏所有geojson定义的标记并仅显示图标?标记有时会出现在图标的顶部。 –