<head><title></title></head>
<body><div class="iw_mail" dir="ltr">Hi,<br><br>I have tried to understand how to create named styles in a WMS configuration, for some time.<br>I would like to have one style that is color and one style for grey scale.<br><br>The manual says the You can do that:<br><br><a href="http://mapserver.org/ogc/sld.html#named-styles-support">http://mapserver.org/ogc/sld.html#named-styles-support</a><br> <br>With the basic set up I get this error when I try and to specify: styles=grey or styles=color<br><br>msWMSLoadGetMapParams(): WMS server error. Invalid style (color). Mapserver is expecting an empty string for the STYLES : STYLES= or STYLES=,,, or using keyword default  STYLES=default,default, ..<br><br>I have also looked at:<br><br><a href="http://mapserver.org/ogc/inspire.html#style-section-for-root-layer-and-possibly-existing-group-layers">http://mapserver.org/ogc/inspire.html#style-section-for-root-layer-and-possibly-existing-group-layers</a><br><br>but I haven't understood that clearly. I don't understand how You set up the different style options.<br><br>When I try to play with wms_style or wms_style_name in main WEB METADATA block<br>and web_style_group_name in layer METEDATA block I get this this error:<br><br>msWMSLoadGetMapParams(): WMS server error. Style (color) not defined on root layer. or<br>msWMSLoadGetMapParams(): WMS server error. Style (grey) not defined on root layer.<br><br>I have created one example mapfile that is easy to understand and that should isolate the problem.<br>I works fine with styles= set to nothing.<br><br>Test url used:<br><br><a href="http://localhost/cgi-bin/mapserv?map=/_YOUR_PATH_/style_test.map">http://localhost/cgi-bin/mapserv?map=/_YOUR_PATH_/style_test.map</a><br>&SERVICE=WMS&REQUEST=Getmap&VERSION=1.1.1<br>&LAYERS=circles,squares<br>&styles=grey<br>&srs=EPSG:4326<br>&BBOX=0,0,20,15<br>&FORMAT=application/openlayers<br>&WIDTH=200&HEIGHT=150<br><br>or<br><br>mapserv -nh "QUERY_STRING=map=/_YOUR_PATH_/style_test.map\<br>&SERVICE=WMS\<br>&REQUEST=Getmap\<br>&VERSION=1.1.1\<br>&LAYERS=ST\<br>&styles=grey\<br>&srs=EPSG:4326\<br>&BBOX=0,0,20,15\<br>&FORMAT=png\<br>&WIDTH=200&HEIGHT=150" > test.png<br><br>/Lars<br><br>testfile: style_test.map<br>----------------------------------<br>MAP<br>    NAME ST<br>    EXTENT 0 0 20 15<br>    SIZE 200 150<br>    UNITS DD<br>    IMAGECOLOR 200 200 200<br>    CONFIG "MS_ERRORFILE" "/tmp/style_test.log"<br>    DEBUG 5<br><br>    OUTPUTFORMAT<br>      NAME 'AGG'<br>      DRIVER AGG/PNG<br>      IMAGEMODE RGB<br>    END<br><br>    WEB<br>      IMAGEPATH "/tmp/ms_tmp/"<br>      IMAGEURL "/ms_tmp/"<br>      METADATA<br>        "wms_srs" "EPSG:3006 EPSG:4326"<br>        "ows_enable_request" "*"<br>      END<br>    END<br><br>    PROJECTION<br>      "init=epsg:4326"<br>    END<br><br>    SYMBOL<br>        NAME "circle"<br>        TYPE ELLIPSE<br>        FILLED TRUE<br>        POINTS 1 1 END<br>    END<br>    SYMBOL<br>        NAME "square"<br>        TYPE VECTOR<br>        FILLED TRUE<br>        POINTS 0 0 0 1 1 1 1 0 0 0 END<br>    END<br>#<br># Start of layer definitions<br>#<br>    LAYER<br>        NAME "circle objects"<br>        TYPE POINT<br>        FEATURE POINTS 10 5 END END<br>        FEATURE POINTS 15 10 END END<br>            METADATA<br>                "wms_title" "Cirles"<br>                "wms_enable_request"   "*"<br>                "wms_layer_group" "/ST/circles"<br>            END<br>        STATUS on<br>        CLASSGROUP "color"<br>        CLASS<br>            NAME "circle-color"<br>            GROUP "color"<br>            STYLE<br>                COLOR 255 0 0<br>                SIZE 15<br>                WIDTH 1<br>                SYMBOL "circle"<br>            END<br>        END<br>        CLASS<br>            NAME "circle-grey"<br>            GROUP "grey"<br>            STYLE<br>                COLOR 50 50 50<br>                SIZE 15<br>                WIDTH 1<br>                SYMBOL "circle"<br>            END<br>        END<br>    END # Layer<br>    LAYER<br>        NAME "square objects"<br>        TYPE POINT<br>        FEATURE POINTS 10 10 END END<br>        FEATURE POINTS 15 5 END END<br>            METADATA<br>                "wms_title" "Squares"<br>                "wms_enable_request"   "*"<br>                "wms_layer_group" "/ST/squares"<br>            END<br>        STATUS on<br>        CLASSGROUP "color"<br>        CLASS<br>            NAME "square-color"<br>            GROUP "color"<br>            STYLE<br>                COLOR 0 0 255<br>                SIZE 15<br>                WIDTH 1<br>                SYMBOL "square"<br>            END<br>        END<br>        CLASS<br>            NAME "square-grey"<br>            GROUP "grey"<br>            STYLE<br>                COLOR 100 100 100<br>                SIZE 15<br>                WIDTH 1<br>                SYMBOL "square"<br>            END<br>        END<br>    END # Layer<br>END # Map File<br><br><br><br><br>
</div></body>