vue中openlayers点击地图获取geoserver的wms图层信息
地图注册点击事件:
this.map.on('click', this.handleMapClick);
点击事件“
/**
* 点击获取影像详情信息
*/
handleMapClick(event) {
const that = this;
// workspace 影像图层id
const xxzqlayer = this.mapServiceLoader?.findLayerById('workspace');
// 获取请求行政区属性的url地址
const wmsSource = xxzqlayer.getSource();
const viewResolution = this.map.getView().getResolution();
const coordinate = event.coordinate;
const url = wmsSource.getFeatureInfoUrl(
coordinate,
viewResolution,
'EPSG:4326'