/**
* 添加单个栅格图层
*/
addRasterLayer() {
this.clearLayer()
let proId = 'gep-r'
let dataId = 'ecoSystemFile'
let para = {
'FORMAT': 'image/png',
'VERSION': '1.1.1',
"LAYERS": proId + ':' + dataId
}
this.currentLayer = new Image({
source: new ImageWMS({
ratio: 2,
url: '/geo/' + proId + '/wms',
params: para
}),
})
this.map.addLayer(this.currentLayer)
//设置图层大小自适应,extentRange:四至[minX,minY,maxX,maxY]
this.map.getView().fit(this.extentRange, this.map.getSize())
}
清空图层
/**
* 清空图层
*/
clearLayer(){
this.map.removeLayer(this.currentLayer)
this.currentLayer = null
}