[mapserver-users] WMS Layers and Grouping (FWD)

Daniel Morissette morissette at dmsolutions.ca
Thu Sep 20 18:05:43 EDT 2001

Paul Ramsey wrote:
> - The WMS Capabilities includes the ability to "nest" layers, such that
> one could have a description like this:
>   <Layer>
>     <Title>Water Features</Title>
>     <Name>water</Name>
>     <Layer>
>       <Title>Rivers</Title>
>       <Name>rivs</Name>
>     </Layer>
>     <Layer>
>       <Title>Lakes</Title>
>       <Name>lks</Name>
>     </Layer>
>   </Layer>
>   This would be kind of cool to be able to do. Using the mapserver
>   'group' idea to implement this is possible. However, I have another
>   question regarding 'group', and it goes like this:

Agreed, this was already filed as a enhancementt:

> - Oftentimes, people will use the mapserver 'group' to provide one
>   "virtual" layer made out of a whole bunch of scale-dependant layers.
>   So, you have a group 'roads' which consists of 1:6Million roads
>   at full extent, 1:250K roads partway in, and 1:20K roads at max
>   zoom. Right now, mapservers WMS will report all the constituent
>   layers of this virtual layer in the Capabilities file, like
>   this:
>   <Layer>
>     <Title>roads_6M</Title>
>   </Layer>
>   <Layer>
>     <Title>roads_250K</Title>
>   </Layer>
>   <Layer>
>     <Title>roads_20K</Title>
>   </Layer>
>   When really, as a map publisher I would prefer to just expost
>   the thing as one virtual layer, thusly:
>   <Layer>
>     <Name>Roads</Name>
>   </Layer>
> So, two different problems, but I do not have a clean solution in my
> head in terms of mapping file syntax, to allow these kinds of WMS
> constructions from a map file.

I agree with your suggestion... in this case the group discussed earlier
would do the trick since it would group under a top-level "Roads" layer
all the scale-specific Roads layers and would still give access to the
individual layers.

However I see why you may not want individual layers to be visible. 
There are a few ways that we could handle this:

1- We could have a "wms_hidden" metadata... if it is set then the layer
is not visible in the WMS capabilities.  We would have to define how
this works in combination with the grouping described above.

2- Right now, if 2 layers have the same name then MapServer's WMS
interface will try to give them unique names in the capabilities by
appending a number to the individual layer names (i.e. if your mapfile
contains 3 layers with name "roads" then the capabilities will return
roads_1, roads_2, roads_3)

We could modify the interface so that it is legal to have layers with
identical names, and then only the first one with that name is shown in
the capabilities, the other ones are automatically hidden.  All layers
with the same name would be turned on automatically in a getMap request
if that layer name is requested.

I had to write this quickly...maybe it won't make much sense when you
read it?  Anyway, if you (and the other users) like one of those options
then you might want to file a enhancement request in bugzilla.

Best Regards,
 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.

More information about the mapserver-users mailing list