[mapserver-users] Multiple styles in a MapServer WMS Service

mmohr marcus.mohr at geobasis-bb.de
Tue Jun 7 02:11:24 PDT 2016


Hello Simon, here is an example that worked for me:

LAYER
  METADATA
    "wms_title" "Test title"
    "wms_style" "first_style"
      "wms_style_default_legendurl_width" "226"
      "wms_style_default_legendurl_height" "431"
      "wms_style_default_legendurl_format" "image/png"
      "wms_style_default_legendurl_href"
"http://eidc.ceh.ac.uk/administration-folder/tools/wms/987544e0-22d8-11e4-8c21-0800200c9a66/legends/LCM2007_DomTar.png"

      "wms_style" "second_style"
      "wms_style_inspire_common:DEFAULT_legendurl_width" "226"
      "wms_style_inspire_common:DEFAULT_legendurl_height" "431"
      "wms_style_inspire_common:DEFAULT_legendurl_format" "image/png"
      "wms_style_inspire_common:DEFAULT_legendurl_href"
"http://eidc.ceh.ac.uk/administration-folder/tools/wms/987544e0-22d8-11e4-8c21-0800200c9a66/legends/LCM2007_DomTar.png"
  END

  NAME      "test_layer"
  CLASSGROUP "first_style"
  TYPE      POLYGON

  INCLUDE "test_dbconnection.include"
  DATA    "the_geom FROM test using srid=25833"
  CLASSITEM "test"
  STATUS ON

  ### FIRST Style ###
  CLASS
    GROUP "first_style"
    NAME "Name 1"
    KEYIMAGE "LCM2007_DomTar.png"
    EXPRESSION "poly_1"
    STYLE
     COLOR 255 137 104
    END
  END

  ### SECOND STYLE ###
CLASS
    GROUP "second_style"
    NAME "Name 2"
    KEYIMAGE "LCM2007_DomTar.png"
    EXPRESSION "poly_2"
    STYLE
     COLOR  243 198 131
    END
  END
END

This layer has three styles now: default, first_style and second_style (you
can easily check that in your GIS). But only the last both styles will
propably appear in the section of your layer capabilities. The default
stylename of your root-element is also "default" (you can change this with
"wms_style_name" in the WEB.METADATA section) and style declarations are
always inherited by child Layers! Inherited styles only appear once (at the
parent element).

If you didn't set the "wms_style_name" in the WEB.METADATA section it's not
a bug if your "default" style doesn't appear in the layer caps. You can get
it anyway.

Please have a look at the OGC WMS 1.3 Specification, Point 7.2.4.6.5
(http://portal.opengeospatial.org/files/?artifact_id=14416) to get more
Information about this behaviour. 



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Multiple-styles-in-a-MapServer-WMS-Service-tp5269071p5270322.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the MapServer-users mailing list