Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created a GeoServer layer group. I'm using OpenLayers.Layer.WMS to retrieve the layer group, and this works fine. In addition, I'd like to pull feature info for the layer. For this, I'm using OpenLayer's GetFeatureInfo. But the GetFeatureInfo only returns feature info for only one of the layers in the layer group. Is there a way I can retrieve feature info for both layers in the group? And, is this an optimal way of dealing with layer groups?

A section of my code is shown below:

    var layer_group = new OpenLayers.Layer.WMS(
        "Sample Layer Group",
        {layers: "layer_group_name", transparent: true},
        {isBaseLayer: false, visibility: false}

to retrieve the layer group.

And:'click', map, function (e) {
        var url =  layer_group.getFullRequestString({
            REQUEST: "GetFeatureInfo",
            EXCEPTIONS: "application/vnd.ogc.se_xml",
            X: e.xy.x,
            Y: e.xy.y,
            INFO_FORMAT: 'text/html',
            QUERY_LAYERS: layer_group.params.LAYERS,

To retrieve the feature info.

My environment setup: GeoServer 2.1.3, PostGIS 1.5, OpenLayers 2.11.

EDIT: The features shown are only for one layer enter image description here

Increasing FEATURE_COUNT only increases the number of instances(rows) returned. The instances are over 1M. What I'd like to achieve is have one row having feature info for all the layers in the layer group.

share|improve this question
have you managed to achieve this? – Pragnesh Patel May 20 '14 at 13:31
up vote 1 down vote accepted

There is no way to achieve what you want with a single request, a new custom behavior would need to be added that only gets only record for each layer. This would require coding, changing the GeoServer GetFeatureInfo code paths to handle a new vendor option (we cannot have such behavior by default, it's probably against the WMS spec).

The only thing I can think of is to know what layers are in the group and issue a separate GetFeatureInfo for each of the layers separately

share|improve this answer
Thanks @Andrea. This is very helpful. – okello Jun 27 '12 at 21:26

GetFeatureInfo by default (per WMS standard) just returns one result, if you want more add FEATURE_COUNT to your request, e.g.:


share|improve this answer
Thanks a lot. Do you have any idea how I can retrieve features for all the layers in the layer group? – okello Jun 26 '12 at 9:41
FEATURE_COUNT only returns more features for the one layer. Feature info for the other layers in the group are not returned, regardless of the value of FEATURE_COUNT. – okello Jun 26 '12 at 10:27
Do you have more than 50 features in the first layer? I've just tried a GetFeatureInfo in the GS preview and I can get features from all the layers in the sample layer groups – Andrea Aime Jun 26 '12 at 14:39
I've edited the question above to reflect what I'm getting as I increase the FEATURE_COUNT. What I'd like is have one row, for instance, having information for each of the layers forming the layer group. Or, perhaps I'm approaching this the wrong way. I'll be grateful for an advice. – okello Jun 27 '12 at 6:03


var layerlist = "layer1:inci,layer2:cableline

QUERY_LAYERS: layerlist,

share|improve this answer
How can this even be syntactically correct when the quotation isn't even closed? – whuber Sep 28 '12 at 16:46
This is actually the correct answer. Yes he did forget a double quote to close the last statement but just add it. – user3657279 Dec 18 '14 at 15:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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