如何更改mapbox标记,我目前的标记是一个点?

时间:2016-09-02 01:10:31

标签: mapbox mapbox-gl mapbox-gl-js

这是我脚本中的代码片段。我想将它更改为汽车图像或引脚标记任何想法如何更改它我试图多次更改它但我没有工作。 i want this marker

map.addControl(new mapboxgl.Navigation());
function pointOnCircle(angle) {
return {
    "type": "Point",
    "coordinates": [long, lat]
};
}

map.on('load', function () {
// Add a source and layer displaying a point which will be animated in a circle.
map.addSource('point', {
    "type": "geojson",
    "data": pointOnCircle(0)
});

map.addLayer({
    "id": "point",
    "source": "point",
    "type": "circle",
    "paint": {
        "circle-radius": 10,
        "circle-color": "#FF0000"
    }
    "icon": "../assets/blue-marker.png"
});

function animateMarker(timestamp) {
    // Update the data to a new position based on the animation timestamp. The
    // divisor in the expression `timestamp / 1000` controls the animation speed.
    map.getSource('point').setData(pointOnCircle(timestamp /800));

    // Request the next frame of the animation.
    requestAnimationFrame(animateMarker);

}
// Start the animation.
animateMarker(0);

0 个答案:

没有答案