我想在使用mapbox定位的位置上添加一个“标记”,然后拖放用户自己的位置
我该怎么做?
我的代码是:
export default class Map extends React.Component {
componentDidMount() {
let map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v10',
center: [34.1108604, 38.8837679],
zoom: 7
});
const geolocate = new mapboxgl.GeolocateControl({
positionOptions: {
enableHighAccuracy: true,
timeout : 10000
},
fitBoundsOptions: {
maxZoom: 17
},
trackUserLocation: false,
showUserLocation: false
});
map.addControl(geolocate);
map.on('load', () => {
geolocate.trigger();
});
}
render() {
return (
<div>
<div id="map" style={Style}/>
</div>
);
}
}
谢谢!