添加一个html覆盖层标签:
核心代码:
map.on("click", function (event) { map.addOverlay( new Overlay({ //设定html元素的基准位置(默认左上角) positioning: "center-center", //鼠标放置在标签元素上,地图是否能停止事件交互 stopEvent:false, element: document.getElementById("marker"), position: event.coordinate, }) ); });
效果:
标签:map,center,Overlay,html,OpenLayers,event From: https://www.cnblogs.com/mesmerize/p/16734161.html