[mapserver-users] Named WMS styles - CLASSGROUP and GROUP

lars.schylberg at blixtmail.se lars.schylberg at blixtmail.se
Thu May 28 06:37:55 PDT 2015


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&REQUEST=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&REQUEST=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&REQUEST=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&REQUEST=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





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20150528/19ad2aa1/attachment-0001.html>


More information about the mapserver-users mailing list