带有 OpenLayers 的信息窗口

InfoWindows with OpenLayers

我目前正在使用 OpenLayers,我想制作类似于 infoWindow 的东西。

我读过这个例子:http://openlayers.org/en/v3.11.2/examples/popup.html,但我认为它是一个 "dirty" 解决方案,与旧版本的 OpenLayers 相比,它有一个 class 的 PopUp 并且你创建了对象直接在javascript,我想知道当前版本是否有其他解决方案

提前致谢

你看到https://github.com/walkermatt/ol3-popup了吗?它可以很简单:

var popup = new ol.Overlay.Popup;
map.addOverlay(popup);

// to show something
popup.show(coord, html);
// hiding
popup.hide();