【发布时间】:2021-06-09 16:22:15
【问题描述】:
早安。
要使用 wfs 层,使用 Leaflet 还是 openlayers 更好?
我有一个从地理服务器返回 WFS 的 openlayers 代码。但我无法在弹出窗口中显示属性。有谁能够帮助我? 谢谢
【问题讨论】:
-
您是否有来自openlayers.org/en/latest/examples/vector-wfs.html 中的 WFS 源显示的数据,并且您想单击openlayers.org/en/latest/examples/icon.html 中的某个要素并显示属性?
-
没错。我可以在地图上显示WFS,但是我不知道如何点击一个点并弹出属性值。
-
codesandbox.io/s/vector-wfs-forked-kh80i 等解决方案适用于任何矢量图层,无论来源如何。为了避免第三方库,它使用 CSS 定义的弹出窗口,如 openlayers.org/en/latest/examples/popup.html
-
我不知道如何从 WFS 层获取要在弹出窗口中显示的功能
-
map.forEachFeatureAtPixel()openlayers.org/en/latest/apidoc/… 在您单击的位置查找矢量特征。如果您有多个矢量图层,您可以使用图层过滤器功能将其限制为您的 WFS 图层。
标签: popup openlayers layer