I would like to organize my layers by topics, and for each of them (if chosen on the client-side), I would like to request a single-tile image, which contains the predefined layers in the correct rendering order (e.g. if one topic has 5 layers, it renders them from the bottom to top like this: water, roads, highways, railways, poi). But, I also want to be capable to request just four of it, or three, etc. in any combination but still in the correct order.
My first idea was Geoserver's "Layer group", but as I've learned that is really more suited for group of layers which are not meant to be turned on/off seperately. (Please let me know if I am wrong about this, though.) And I also kinda lose Getfeatureinfo capability with this.
After some research I figured out, that in the GetMap request, if I add all my layers' name in the correct order (from bottom to top-->LAYERS=water,roads,highways,railways,poi), I get the same result, and I can also narrow down the list to the required ones.
The GetMap solution seems to by right, but in that case I need to fill up the list for each topic on the client side.
So my main question: is there a solution to get a list of layers from Geoserver by topic in the right rendering order? Or is there an extension for organizing layers this way? (I haven't seen any extension for that purpose)
My idea was that if I organize all layers of a topic to a workspace, I can request a getCapabilities for the workspace WMS endpoint, parse and read out the layers, but unfortunately it gives back the layers in a pseudo-random order, so not really good. Maybe a custom getCapabilities XML can solve this?
Please share your ideas, what's the best practice to do this?
I'm on Geoserver 2.4.2.