0

I have a layer group with multiple layers as following

enter image description here

In Angular I created an OpenLayers map adding the group layer like this:

this.capaPropia =
new ImageLayer({
  source: new ImageWMS({
    url: environment.baseUrl + 'handlerGeoserver.ashx',
    params: {LAYERS: 'v_expedientesAgrupados'},
    projection: proyeccion
  })
});

In my app I have 4 checkboxes, one for each layer. I need to display only the layers of the group layer that are checked.

Is it possible to filter layers from a group layer on GeoServer (with cql_filter or similar)? If so, can this be done with OpenLayers?

1 Answer 1

2

That is not how layergroups work, they are a single indivisible layer as far as the client is concerned so there is no way to know that there are 4 layers inside it let alone turn them on or off.

You need to request the 4 layers separately from the server to allow the client to turn them on and off. See this question for example code.

1
  • Thank you, Ian!
    – Iñigo
    Commented Feb 24, 2020 at 9:10

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.