OpenLayers6(2):Vue中使用ol-ext插件中的LayerSwitcher图层控制控件

1.版本

  • OpenLayers:6.4.3

  • ol-ext:3.2.22(条件:"ol": ">= 5.3.0")

2.配置ol-ext

// 1、安装ol-ext
npm i ol-ext

// 2、在main.js中引入样式
import 'ol-ext/dist/ol-ext.min.css';

3.使用LayerSwitcher控件

3.1 先看LayerSwitcher构造函数的参数

LayerSwitcher控件的构造函数参数
selection enable layer selection when click on the title
displayInLayerSwitcher function that takes a layer and return a boolean if the layer is displayed in the switcher, default test the displayInLayerSwitcher layer attribute
show_progress show a

猜你喜欢

转载自blog.csdn.net/qq_34520411/article/details/124345531