[mapserver-users] Named WMS styles - CLASSGROUP and GROUP
lars.schylberg at blixtmail.se
lars.schylberg at blixtmail.se
Wed May 27 07:16:45 PDT 2015
Hi,
I have tried to understand how to create named styles in a WMS configuration, for some time.
I would like to have one style that is color and one style for grey scale.
The manual says the You can do that:
http://mapserver.org/ogc/sld.html#named-styles-support
With the basic set up I get this error when I try and to specify: styles=grey or styles=color
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, ..
I have also looked at:
http://mapserver.org/ogc/inspire.html#style-section-for-root-layer-and-possibly-existing-group-layers
but I haven't understood that clearly. I don't understand how You set up the different style options.
When I try to play with wms_style or wms_style_name in main WEB METADATA block
and web_style_group_name in layer METEDATA block I get this this error:
msWMSLoadGetMapParams(): WMS server error. Style (color) not defined on root layer. or
msWMSLoadGetMapParams(): WMS server error. Style (grey) not defined on root layer.
I have created one example mapfile that is easy to understand and that should isolate the problem.
I works fine with styles= set to nothing.
Test url used:
http://localhost/cgi-bin/mapserv?map=/_YOUR_PATH_/style_test.map
&SERVICE=WMS&REQUEST=Getmap&VERSION=1.1.1
&LAYERS=circles,squares
&styles=grey
&srs=EPSG:4326
&BBOX=0,0,20,15
&FORMAT=application/openlayers
&WIDTH=200&HEIGHT=150
or
mapserv -nh "QUERY_STRING=map=/_YOUR_PATH_/style_test.map\
&SERVICE=WMS\
&REQUEST=Getmap\
&VERSION=1.1.1\
&LAYERS=ST\
&styles=grey\
&srs=EPSG:4326\
&BBOX=0,0,20,15\
&FORMAT=png\
&WIDTH=200&HEIGHT=150" > test.png
/Lars
testfile: style_test.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 objects"
TYPE POINT
FEATURE POINTS 10 5 END END
FEATURE POINTS 15 10 END END
METADATA
"wms_title" "Cirles"
"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 objects"
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/20150527/b8bc9523/attachment.htm>
More information about the MapServer-users
mailing list