[mapserver-users] WMS Layer Ordering

Paul Ramsey pramsey at refractions.net
Tue May 21 08:56:10 PDT 2002


The behavior is as you describe. So there is a rhyme and a reason to it!
However, I would propose an alternate model which allows more
cartographic control:

- The placement of groups in the WMS capabilities should be based on the
location of the first layer declared in the group.

So (abbreviatedly), a mapfile which does this:

LAYER water
LAYER roads6m (roads)
LAYER cities
LAYER roads2m (roads)
LAYER roads25k (roads)
LAYER airports

Would come out as this in WMS:

<Layer>
  <Layer water></Layer>
  <Layer roads>
    <Layer roads6m></Layer>
    <Layer roads2m></Layer>
    <Layer roads25k></Layer>
  </Layer>
  <Layer cities></Layer>
  <Layer airports></Layer>
</Layer>

This way the mapfile writer retains control over the rendering order of
things. As it stands, it is impossible to place an ungrouped layer on
top of a grouped one.

P.

Daniel Morissette wrote:
> 
> Paul Ramsey wrote:
> >
> > What is the algorithm which determines the relationship between layer
> > ordering in the map file and the layer ordering in the WMS capabilities?
> > They do not appear to match up 1:1.
> 
> Hi Paul,
> 
> Unless you have uncovered a bug, which is always possible, then the
> order of the layers in the capabilities should be:
> 
> 1- First all layers that do NOT belong to any group are listed in the
> order that they appear in the mapfile
> 
> 2- Then the layers that belong to a group are listed by group.  The
> order of the groups should be based on the order of first of occurence
> of each group when scanning the layers in the mapfile.
> 
> If this is not the behavior that you witnessed then please file a bug
> about this with a sample mapfile and I'll have a look.
> 
> > This is not an unimportant problem,
> > since the layer order passed in the GetMap request seems to be respected
> > by the renderer (so if I say LAYERS=roads,lakes my water features will
> > be rendered on top of my roads features). So if I read my layers out of
> > GetCapabilities, and then apply those layers in a GetMap in exactly the
> > same order I get them, the result may be quite different from the result
> > if I did the same query using the mapserver interface instead of the WMS
> > interface.
> >
> 
> I agree that if you have some layers with a group value and some without
> group values then following the order of layers in the capabilities
> could lead to cartographically invalid results.
> 
> Suggestions of better ways to handle this are welcome.
> 
> Thanks,
> 
> Daniel
> --
> ------------------------------------------------------------
>  Daniel Morissette               morissette at dmsolutions.ca
>  DM Solutions Group              http://www.dmsolutions.ca/
> ------------------------------------------------------------
>   Don't put for tomorrow what you can do today, because if
>       you enjoy it today you can do it again tomorrow.

-- 
      __
     /
     | Paul Ramsey
     | Refractions Research
     | Email: pramsey at refractions.net
     | Phone: (250) 885-0632
     \_



More information about the MapServer-users mailing list