1

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 separately. (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.

1
  • 1
    No, I do not think Geoserver has a notion of "right rendering order"
    – atlefren
    Commented Jan 16, 2015 at 13:47

2 Answers 2

1

You don't mention what your client is...

If you're using JavaScript, you can form a WMS request that includes multiple layers and the order in the request changes what order they are rendered in. This is getting into custom web-mapping though, and it will take a bit of coding to set up a UI that lets you turn on and off layers, and ensures that they are rendered in the order you want.

So, let us know what client you're using and I'll update.

1
  • I use openlayers 3 on the client side, but the issue in my point of view is more related to geoserver, and its getcapabilities "answer". As I use the getcapabilities file to construct my layer list, i cannot get from one WMS service both the correct getcapabilities and the getFeatureinfo. For this I decided to use some otherwise not used wms field to add the serial number of the layer of the group layer, and then I order it on the client side by this, and it seems to solve the problem so far. Commented Dec 16, 2014 at 12:36
0

Maybe the tag "Default WMS Path" in the "publishing" tab of each layer could help you, at least in part:

http://docs.geoserver.org/stable/en/user/webadmin/data/layers.html#edit-layer-data

2
  • And how does that help me with my problem? Can you elaborate on that? Commented Mar 11, 2014 at 15:00
  • using this feature you can view in a client as QGIS layers grouped as per their paths and if I'm not mistaken the layers of the groups are sorted alphabetically. Commented Mar 12, 2014 at 8:01

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.