OpenLayers隐藏默认放大放小按钮

import {Map, View} from 'ol'; import TileWMS from 'ol/source/TileWMS'; import TileLayer from 'ol/layer/Tile'; import {ScaleLine, defaults as defaultControls} from 'ol/control'; //安徽省数据源 let wmsSource = new TileWMS({ url: `http://192.168.11.193:8080/ndc/wms?styles=${this.layerStyles}`, params: { "LAYERS": this.layerName, }, serverType: 'geoserver', }); this.map = new Map({ target: 'map', //地图容器div的ID view: new View({ projection: 'EPSG:4326' }), layers: new TileLayer({ source: wmsSource, crossOrigin: 'anonymous' }), //加载控件到地图容器中 controls: defaultControls({ zoom: false, rotate: false, attribution: false }).extend([ new ScaleLine({ //设置比例尺单位,degrees、imperial、us、nautical、metric(度量单位) units: "metric" }) ]) });

zoom:false 不显示放大放小按钮;
rotate: false 不显示指北针控件;
attribution: false 不显示右下角的地图信息控件;
scaleLine(比例尺)

你可能感兴趣的:(前端,vue,openlayers,vue,webgis)