Getinfo only returns the first cover inserted

107 Views Asked by At

I'm using GetInfo to view the cover information and my problem using this command is: The information displayed is not from the cover seen on the map, but from the first cover inserted in the code. I always see information from the cover Layer_21_11_19 even if I'm seeing and clicking on the cover Layer_12_12_19.

Please, does anyone know how to show the information only on the cover I'm seeing and clicking?

map.on('click', function getInfo(e){
 if(e.name !== 'Click'){
  e.name = "Click";
  map.addEventListener('click', (evt) => {
   const projection = map.getView().getProjection().getCode()
   const isGlobal = map.getView().getProjection().isGlobal()
   const viewResolution = view.getResolution();
   const wmsSource = new ol.source.ImageWMS({
    url: 'http://localhost:8080/geoserver/WORK/wms',
     params: {'LAYERS': [
      'Layer_21_11_19',
      'Layer_23_11_19',
      'Layer_12_12_19'
     ]}
   });
   url = wmsSource.getFeatureInfoUrl(
    evt.coordinate,
    viewResolution,
    'EPSG:4326',
    {'INFO_FORMAT': 'text/html','FEATURE_COUNT': 1}
   );
 }
})

0

There are 0 best solutions below