Closed David102400 closed 3 years ago
谢谢您报的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:https://github.com/openlayers/openlayers/issues/3622 openlayers官方例子:https://openlayers.org/en/v4.6.5/examples/layer-group.html
希望对您有帮助。
在超图官方示例中的图层控制功能不能在yarn或npm下载的代码中使用。由于超图的4.6.5不是openlayers官方的4.6.5,故无法使用图层控制插件。
iClient的官网中的范例https://iclient.supermap.io/examples/openlayers/editor.html#controler_layerswitcher 中使用的layerswitcher是开源插件ol-layerswitcher,并非内部集成功能。 在yarn和npm中使用请参照该插件的引入方法 (注意ol5版本以下请安装ol-layerswitcher@v2.0.0)。
是的。问题就在于开源插件ol-layerswitcher是对于yarn ol@4.6.5
是可以使用的,但是对于yarn @supermap/iclient-openlayers
中的openlayers4.6.5是无法使用的
您提到的“超图的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,方便我们跟踪并解决问题,谢谢。
明白您的意思了。 @supermap/iclient-openlayers@10.0.0 中使用的是openlayers@4.6.5 https://openlayers.org/en/v4.6.5/doc/tutorials/custom-builds.html
ol-layerswitcher@v2.0.0 中引用的是ol@4.6.5。
我们重现下问题,并寻找解决方案。给您带来不便深表歉意。
@supermap/iclient-ol 最新版本已支持ol5/6及ol-layerswitcher@3.0.0以上。欢迎使用。
Request a feature or report a bug? [需求]
One-line summary [没有实例中的LayerSwitch控件]
Version [产品及版本]
What is motivation or use case for changing the behavior? [实现图层控制]