0

enter image description here enter image description here

 var layer = L.tileLayer.betterWms("http://localhost:8080/geoserver/wms", {
    layers: 'data',
    format: 'image/png',
    transparent: true,
}).addTo(map);

When adding this GROUP WMS Layer on a base map Leaflet, onclick I am getting only one Layer data but Layer Group showing well 2 Layer. I want to get info about both layers on click.

I am using betterwms.js Leaflet plugin.

enter image description here

1
  • @TomazicM its group layer from geoserver and code is also there Commented Jan 30, 2022 at 16:05

2 Answers 2

1

If you look at the code of Leaflet betterWms plugin, you'll see that parameters for GetFeatureInfo request are constructed like this:

params = {
  request: 'GetFeatureInfo',
  service: 'WMS',
  srs: 'EPSG:4326',
  styles: this.wmsParams.styles,
  transparent: this.wmsParams.transparent,
  version: this.wmsParams.version,      
  format: this.wmsParams.format,
  bbox: this._map.getBounds().toBBoxString(),
  height: size.y,
  width: size.x,
  layers: this.wmsParams.layers,
  query_layers: this.wmsParams.layers,
  info_format: 'text/html'
};

Since there is no feature_count parameter, it defaults to 1, and that's the reason why you get info only about one feature.

You'll have to edit plugin code and set this parameter to desired value.

0

If you host the wms through geoserver, you setup the return info template inside there, with the code to return data for all layers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.