Have you tried using GROUP "ST" instead of wms_layer_group metadata? This seems 
to be the intended way to create a named group that can be requested. There 
seems to be no way to declare styles at group (or root) level. Requesting the 
group "ST" with style "grey" or "color" works but clients might be confused if 
the capabilities advertise a style at each leaf layer but none at group level.

Changing your mapfile to

LAYER
        NAME "circle"
        GROUP "ST"
        METADATA
                # "wms_layer_group" "/ST/circles"
...

LAYER
        NAME "square"
        GROUP "ST"
        METADATA
                # "wms_layer_group" "/ST/squares"

At least allows requesting the group "ST" with style color or grey:
        "...&layers=ST&styles=grey&..." or "...&layers=ST&styles=color&..."
and requesting each single leaf layer:
        "...&layers=circle,square&styles=color,grey&..."

HTH

> -----Ursprüngliche Nachricht-----
> Von: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-
> boun...@lists.osgeo.org] Im Auftrag von lars.schylb...@blixtmail.se
> Gesendet: Donnerstag, 28. Mai 2015 15:38
> An: mapserver-users@lists.osgeo.org
> Betreff: Re: [mapserver-users] Named WMS styles - CLASSGROUP and GROUP
> 
> Hi again,
> 
> I have modified my example and found out some things that works and some
> that don't work.
> Actually I got a little furhter looking at:
> https://github.com/mapserver/mapserver/issues/4660
> 
> One layer with "layer name" as Layer=square gives correct result with both
> styles=color and styles=grey.
> That is the layer name from the Layer name declaration.
> 
>  http://localhost/cgi-
> bin/mapserv?map=/home/lars/Maps/Style_test/style_test_5.map&SERVICE=WMS&RE
> QUEST=Getmap&VERSION=1.1.1
> &LAYERS=square&styles=grey
> &srs=EPSG:4326&BBOX=0,0,20,15&FORMAT=image/png&WIDTH=200&HEIGHT=150
> 
> Two layers with "layer name" as Layer=square,circle  gives correct result
> if I give two arguments to  styles ie. styles=grey,grey or
> styles=color,color or styles=grey,color.
> 
> http://localhost/cgi-
> bin/mapserv?map=/home/lars/Maps/Style_test/style_test_5.map&SERVICE=WMS&RE
> QUEST=Getmap&VERSION=1.1.1
> &LAYERS=circle,square&styles=grey,grey
> &srs=EPSG:4326&BBOX=0,0,20,15&FORMAT=image/png&WIDTH=200&HEIGHT=150
> 
> If I specify the layer with layers from "wms_layer_group" "/ST/circles"
> and /ST/squares that is layers=circles,squares it seem like the style
> given with styles parameter is ignored. It is only showing the default
> CLASSGROUP regardless of how styles is specified. as long as I have two
> arguments.
> 
> http://localhost/cgi-
> bin/mapserv?map=/home/lars/Maps/Style_test/style_test_5.map&SERVICE=WMS&RE
> QUEST=Getmap&VERSION=1.1.1
> &LAYERS=squares,circles&styles=grey,grey
> &srs=EPSG:4326&BBOX=0,0,20,15&FORMAT=image/png&WIDTH=200&HEIGHT=150
> 
> It seems like the style is not assosiated with the the layer handling with
> wms_layer_groups.
> I suspect that there is some undocumented way to do that.
> 
> If I specify the layers with the root layer name ,  ST
> 
> http://localhost/cgi-
> bin/mapserv?map=/home/lars/Maps/Style_test/style_test_5.map&SERVICE=WMS&RE
> QUEST=Getmap&VERSION=1.1.1&
> LAYERS=ST&styles=grey
> &srs=EPSG:4326&BBOX=0,0,20,15&FORMAT=image/png&WIDTH=200&HEIGHT=150
> 
> I get the following error.
> 
> <ServiceException code="StyleNotDefined">
> msWMSLoadGetMapParams(): WMS server error. Style (grey) not defined on
> root layer.
> </ServiceException>
> 
> So to conclude, I am wordering if there is a way to  specify the style for
> the root layer?
> Because that is really what I would like to do.
> 
> Second question is how do I associate the style to layers in
> wms_layer_group instead of the layers specified in the layer name.
> 
> I hope this wasn't to long. All input would be welcome.
> 
> Lars Schylberg
> 
> New mapfile: style_test_5.map
> ------
> MAP
>     NAME ST
>     EXTENT 0 0 20 15
>     SIZE 200 150
>     UNITS DD
>     IMAGECOLOR 200 200 200
>     CONFIG "MS_ERRORFILE" "/tmp/style_test.log"
>     DEBUG 5
> 
>     OUTPUTFORMAT
>       NAME 'AGG'
>       DRIVER AGG/PNG
>       IMAGEMODE RGB
>     END
> 
>     WEB
>       IMAGEPATH "/tmp/ms_tmp/"
>       IMAGEURL "/ms_tmp/"
>       METADATA
>         "wms_srs" "EPSG:3006 EPSG:4326"
>         "ows_enable_request" "*"
>       END
>     END
> 
>     PROJECTION
>       "init=epsg:4326"
>     END
> 
>     SYMBOL
>         NAME "circle"
>         TYPE ELLIPSE
>         FILLED TRUE
>         POINTS 1 1 END
>     END
>     SYMBOL
>         NAME "square"
>         TYPE VECTOR
>         FILLED TRUE
>         POINTS 0 0 0 1 1 1 1 0 0 0 END
>     END
> #
> # Start of layer definitions
> #
>     LAYER
>         NAME "circle"
>         TYPE POINT
>         FEATURE POINTS 10 5 END END
>         FEATURE POINTS 15 10 END END
>             METADATA
>                 "wms_title" "Circles"
>                 "wms_enable_request"   "*"
>                 "wms_layer_group" "/ST/circles"
>             END
>         STATUS on
>         CLASSGROUP "color"
>         CLASS
>             NAME "circle-color"
>             GROUP "color"
>             STYLE
>                 COLOR 255 0 0
>                 SIZE 15
>                 WIDTH 1
>                 SYMBOL "circle"
>             END
>         END
>         CLASS
>             NAME "circle-grey"
>             GROUP "grey"
>             STYLE
>                 COLOR 50 50 50
>                 SIZE 15
>                 WIDTH 1
>                 SYMBOL "circle"
>             END
>         END
>     END # Layer
>     LAYER
>         NAME "square"
>         TYPE POINT
>         FEATURE POINTS 10 10 END END
>         FEATURE POINTS 15 5 END END
>         METADATA
>             "wms_title" "Squares"
>             "wms_enable_request"   "*"
>             "wms_layer_group" "/ST/squares"
>         END
>         STATUS on
>         CLASSGROUP "color"
>         CLASS
>             NAME "square-color"
>             GROUP "color"
>             STYLE
>                 COLOR 0 0 255
>                 SIZE 15
>                 WIDTH 1
>                 SYMBOL "square"
>             END
>         END
>         CLASS
>             NAME "square-grey"
>             GROUP "grey"
>             STYLE
>                 COLOR 100 100 100
>                 SIZE 15
>                 WIDTH 1
>                 SYMBOL "square"
>             END
>         END
>     END # Layer
> END # Map File
> 
> 
> 

_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to