More

Determining base layers versus overlays


I'm working to build a dynamic map, which pulls data from GeoServer to get the list of available layers, and then uses Leaflet to allow the user to determine which specific layers to display. Leaflet and OpenLayers both support the context of a base layer, in which the user selects one base, with as many overlays as they then need.

I'm successfully pulling the list of layers from GeoServer's GetCapabilities call. However, I've not determined a way to suggest which layers are good candidates for base, versus which should be considered overlays. I've cross-checked the responses returned for WMS and WFS, as well as version 1.1 versus 1.3. Suspect it's a concept issue on my part. Can someone clarify how to distinguish between base and overlay layers for layer lists returned from GeoServer?


The WMS spec provides the ability to mark a layer as Opaque or not, this is designed to allow client developers to distinguish base layers (which are, or should be, marked opaque) from overlays which aren't.

I'm not sure how common it is for people who set up WMS servers to populate this value - I can't think of a time I ever have. Interestingly this note on the GeoServer code base suggests for some layers this will be set automatically.