<!-- 为了方便我们能够尽快重现、修复 bug或响应您的需求,请遵从下面的规范描述您的问题。 --> ### Request a feature or report a bug? [需求] ### One-line summary [没有实例中的LayerSwitch控件] ### Version [产品及版本] + iClient product (for leaflet,for openlayers,for mapboxgl,classic)[openlayers]: + iClient version [10]: + Browser version 谷歌]: + OS Version [win10]: ---------- <!-- ## If this is a feature request [如果这是一个需求] --> ### What is motivation or use case for changing the behavior? [实现图层控制]
Activity
songyumeng commentedon Dec 20, 2019
谢谢您报的issue,不好意思没有明白您的问题。
下面是关于openlayers的LayerSwitch功能一些插件和demo:
iClient例子:https://iclient.supermap.io/examples/openlayers/editor.html#controler_layerswitcher
使用的插件是:https://github.com/walkermatt/ol-layerswitcher
openlayers关于不内置layer switch的issue:openlayers/openlayers#3622
openlayers官方例子:https://openlayers.org/en/v4.6.5/examples/layer-group.html
希望对您有帮助。
David102400 commentedon Dec 20, 2019
在超图官方示例中的图层控制功能不能在yarn或npm下载的代码中使用。由于超图的4.6.5不是openlayers官方的4.6.5,故无法使用图层控制插件。
songyumeng commentedon Dec 20, 2019
iClient的官网中的范例https://iclient.supermap.io/examples/openlayers/editor.html#controler_layerswitcher
中使用的layerswitcher是开源插件ol-layerswitcher,并非内部集成功能。
在yarn和npm中使用请参照该插件的引入方法 (注意ol5版本以下请安装[email protected])。
David102400 commentedon Dec 20, 2019
是的。问题就在于开源插件ol-layerswitcher是对于
yarn [email protected]是可以使用的,但是对于yarn @supermap/iclient-openlayers中的openlayers4.6.5是无法使用的songyumeng commentedon Dec 20, 2019
您提到的“超图的4.6.5不是openlayers官方的4.6.5”,这个不知您怎么得出结论的。
iClient中使用的openlayers 4.6.5 是 openlayers的官方的4.6.5。
在npm中安装的依赖是
"dependencies": {
"openlayers": "4.6.5"
}。
在例子中引入的是bootcdn提供的openlayers的cdn地址https://cdn.bootcss.com/openlayers/4.6.5/ol.js
更换成ol官方的js地址也是没有问题的。
如果是您再使用中遇到什么问题。请描述一下及提供相关demo,方便我们跟踪并解决问题,谢谢。
songyumeng commentedon Dec 20, 2019
明白您的意思了。
@supermap/[email protected] 中使用的是[email protected] https://openlayers.org/en/v4.6.5/doc/tutorials/custom-builds.html
[email protected] 中引用的是[email protected]。
我们重现下问题,并寻找解决方案。给您带来不便深表歉意。
songyumeng commentedon Oct 14, 2020
@supermap/iclient-ol 最新版本已支持ol5/6及[email protected]以上。欢迎使用。