mapbox使用marker创建html点位信息

mapbox使用marker创建html点位信息

mapbox使用marker创建html点位信息_第1张图片

codePen地址

mapboxgl.accessToken =
	"pk.eyJ1IjoibGl1emhhbzI1ODAiLCJhIjoiY2xmcnV5c2NtMDd4eDNvbmxsbHEwYTMwbCJ9.T0QCxGEJsLWC9ncE1B1rRw";
const center = [121.29786, 31.19365];
const map = new mapboxgl.Map({
	container: "map",
	// Choose from Mapbox's core styles, or make your own style with Mapbox Studio
	style: "mapbox://styles/mapbox/streets-v12",
	center,
	zoom: 12.5
});

let points = {
	id: "test"
};
const element = document.createElement("div");

element.innerHTML = `
${points.id}
`
; const marker = new mapboxgl.Marker({ element }) .setLngLat(center) .addTo(map);

你可能感兴趣的:(Mapbox,swift,开发语言,ios)