Re: [mapserver-users] Multiple styles in a MapServer WMS Service
Made a mistake at the metadata. Use this: METADATA "wms_title" "Test title" "wms_style" "first_style" "wms_style_first_style_legendurl_width" "226" "wms_style_first_style_legendurl_height" "431" "wms_style_first_style_legendurl_format" "image/png" "wms_style_first_style_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_second_style_legendurl_width" "226" "wms_style_second_style_legendurl_height" "431" "wms_style_second_style_legendurl_format" "image/png" "wms_style_second_style_legendurl_href" "http://eidc.ceh.ac.uk/administration-folder/tools/wms/987544e0-22d8-11e4-8c21-0800200c9a66/legends/LCM2007_DomTar.png; END -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Multiple-styles-in-a-MapServer-WMS-Service-tp5269071p5270330.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Multiple styles in a MapServer WMS Service
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. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Multiple styles in a MapServer WMS Service
Hi Jeff Many thanks for your reply and the code snippet which I can get to work and display multiple styles in the WMS GetCapabilities document. However, I'm trying to use the wms_style and wms_style_[style_name]_legendurl_width, _height, _format, and _href syntax to define multiple legends as outlined on the MapServer WMS Server documentation - http://mapserver.org/ogc/wms_server.html - to define multiple styles for pre-generated legend images (specified with the _legendurl_href). In the layer section of my .map file I have the following parameters defined: "wms_style""default" "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" "inspire_common:DEFAULT" "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; However, the GetCapabilities document created by MapServer 7.0.1 only lists one
Re: [mapserver-users] Multiple styles in a MapServer WMS Service
Hi Simon, I am not sure why some of my emails are not making it through to this list (I had sent my code snippets here back on 2016-05-31). Here is another try: sorry for using an external link but since my emails are not going through I have no choice: http://pastebin.com/9aVSv6K1 -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ On 2016-06-02 11:59 AM, Wright, Simon M. wrote: Hi Jeff and Andreas I’m still struggling with getting multiple styles to appear in my MapServer WMS GetCapabilities file. I guess this is because I’m fairly new to MapServer. In the meantime I have also upgraded the version of MapServer that I’m using to 7.0.1 to ensure there aren’t any issues with versions. Would it be possible for you to show me the map files with the CLASSGROUP you have created to get multiple styles to appear in the WMS GetCapabilities document? Also, Jeff, which block of metadata did you delete to get multiple styles to appear? The metadata in the MAP | WEB | METADATA or the metadata in MAP | LAYER | METADATA? Many thanks for your help. Best wishes, Simon. This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Multiple styles in a MapServer WMS Service
Hi Jeff and Andreas I'm still struggling with getting multiple styles to appear in my MapServer WMS GetCapabilities file. I guess this is because I'm fairly new to MapServer. In the meantime I have also upgraded the version of MapServer that I'm using to 7.0.1 to ensure there aren't any issues with versions. Would it be possible for you to show me the map files with the CLASSGROUP you have created to get multiple styles to appear in the WMS GetCapabilities document? Also, Jeff, which block of metadata did you delete to get multiple styles to appear? The metadata in the MAP | WEB | METADATA or the metadata in MAP | LAYER | METADATA? Many thanks for your help. Best wishes, Simon. This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Multiple styles in a MapServer WMS Service
Hi Simon, We had to create a CLASSGROUP for every style and on every layer: LAYER CLASSGROUP 'Style1' CLASSGROUP 'Style2' CLASS GROUP 'Style1' STYLE [...] END END CLASS GROUP 'Style2' STYLE [...] END END END With this, they are advertised as: [...] <Name>Style1</Name> [...] <Name>Style2</Name> [...] And you can request the one to use on GetMap-Requests using the STYLES parameter. HTH > -Ursprüngliche Nachricht- > Von: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] Im > Auftrag von Wright, Simon M. > Gesendet: Dienstag, 31. Mai 2016 14:37 > An: mapserver-users@lists.osgeo.org > Betreff: [mapserver-users] Multiple styles in a MapServer WMS Service > > Dear All > > > > I'm fairly new to MapServer and am trying to create a WMS Service. > > > > I have defined two styles the following metadata section of a layer as > follows: > > > > METADATA > > "wms_title" "LC.LandCoverSurfaces" > > "wms_srs" "CRS:84 EPSG:4326 EPSG:27700 EPSG:4258 > EPSG:3857" > > "wms_metadataurl_type" "ISO19115:2003" > > "wms_metadataurl_format" "text/xml" > > "wms_metadataurl_href" > "https://catalogue.ceh.ac.uk//id/a1f88807-4826-44bc-994d-a902da5119c2?; > > "wms_style" "default" > > "wms_style_default_legendurl_title" "" > > "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" "inspire_common:DEFAULT" > > "wms_style_inspire_common:DEFAULT_legendurl_title" > "LC.LandCoverSurfaces Default 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" > > > > But only one style is actually broadcast in the WMS GetCapabilities > document: > > > > > > LC.LandCoverSurfaces > > LC.LandCoverSurfaces > > CRS:84 > > EPSG:4326 > > EPSG:27700 > > EPSG:4258 > > EPSG:3857 > > > > -9.49714 > > 3.63202 > > 49.7668 > > 61.581 > > > > maxy="61.581"/> > > maxy="3.63202"/> > > maxy="1.3e+06"/> > > maxy="3.63202"/> > > maxx="404315" maxy="8.76046e+06"/> > > > > text/xml > > http://www.w3.org/1999/xlink; > xlink:type="simple" xlink:href="https://catalogue.ceh.ac.uk//id/a1f88807- > 4826-44bc-994d-a902da5119c2?"/> > > > > > > <Name>inspire_common:DEFAULT</Name> > > <Title>inspire_common:DEFAULT</Title> > > <LegendURL width="226" height="431"> > > <Format>image/png</Format> > > <OnlineResource xmlns:xlink="<a rel="nofollow" href="http://www.w3.org/1999/xlink"">http://www.w3.org/1999/xlink"</a>; > xlink:type="simple" xlink:href="<a rel="nofollow" href="http://eidc.ceh.ac.uk/administration-">http://eidc.ceh.ac.uk/administration-</a> > folder/tools/wms/987544e0-22d8-11e4-8c21- > 0800200c9a66/legends/LCM2007_DomTar.png"/> > > </LegendURL> > > > > > > > > It appears that the last defined style is the one that makes it through to > the GetCapabilities file. > > > > > > > > Therefore, am I specifying my styles incorrectly in the .map file? > > > > Is it possible to define multiple styles for the GetCapabilities document? > > > > Or, is this a bug in MapServer 6.4.2? And if so, should I use a later > version of MapServer? > > > > > > > > Many thanks for any help that anyone can provide. > > > > > > > > Best wishes, Simon. > > > > This message (and any attachments) is for the recipient only. NERC is > subject to the Freedom of Information Act 2000 and the contents of this > email and any reply you make may be disclosed by NERC unless it is exempt > from release under the Act. Any material supplied to NERC may be stored in > an electronic records management system. > ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Multiple styles in a MapServer WMS Service
Hi Simon, I just locally enabled 2 different styles, and they showed up in my GetCapabilities document, by using CLASSGROUP and GROUP in my mapfile layer (see the RFC examples at http://mapserver.org/development/rfc/ms-rfc-39.html). Note that I deleted your layer metadata, and magically both styles appeared in the GetCapabilities. There could be a bug there (why your metadata doesn't work I am not sure), but to get the 2 styles to appear I followed that RFC. I am testing with MS4W 3.1.4 (MapServer 7.0.1). http://ms4w.com -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ On 2016-05-31 9:37 AM, Wright, Simon M. wrote: Dear All I’m fairly new to MapServer and am trying to create a WMS Service. I have defined two styles the following metadata section of a layer as follows: METADATA "wms_title" "LC.LandCoverSurfaces" "wms_srs" "CRS:84 EPSG:4326 EPSG:27700 EPSG:4258 EPSG:3857" "wms_metadataurl_type" "ISO19115:2003" "wms_metadataurl_format" "text/xml" "wms_metadataurl_href" "https://catalogue.ceh.ac.uk//id/a1f88807-4826-44bc-994d-a902da5119c2?; "wms_style" "default" "wms_style_default_legendurl_title" "" "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" "inspire_common:DEFAULT" "wms_style_inspire_common:DEFAULT_legendurl_title" "LC.LandCoverSurfaces Default 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; But only one style is actually broadcast in the WMS GetCapabilities document: LC.LandCoverSurfaces LC.LandCoverSurfaces CRS:84 EPSG:4326 EPSG:27700 EPSG:4258 EPSG:3857 -9.49714 3.63202 49.7668 61.581 text/xml http://www.w3.org/1999/xlink; xlink:type="simple" xlink:href="https://catalogue.ceh.ac.uk//id/a1f88807-4826-44bc-994d-a902da5119c2?"/>inspire_common:DEFAULT inspire_common:DEFAULT It appears that the last defined style is the one that makes it through to the GetCapabilities file. Therefore, am I specifying my styles incorrectly in the .map file? Is it possible to define multiple styles for the GetCapabilities document? Or, is this a bug in MapServer 6.4.2? And if so, should I use a later version of MapServer? Many thanks for any help that anyone can provide. Best wishes, Simon. This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users image/png http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://eidc.ceh.ac.uk/administration-folder/tools/wms/987544e0-22d8-11e4-8c21-0800200c9a66/legends/LCM2007_DomTar.png"/>