[mapserver-users] [EXTERNAL] RE: Multiple Styles for a LAYER/CLASS

lars.schylberg at blixtmail.se lars.schylberg at blixtmail.se
Tue Sep 15 01:43:33 PDT 2020


Some example urls that makes it easier to test.  
Change "/home/lars" to where you placed the files. 

http://localhost/cgi-bin/mapserv?
map=/home/lars/style_test/style_test.map
&SERVICE=WMS
&REQUEST=Getmap
&VERSION=1.1.1
&LAYERS=square,circle
&styles=green,grey
&srs=EPSG:4326
&BBOX=0,0,20,15
&FORMAT=image/png
&WIDTH=200
&HEIGHT=150

http://localhost/cgi-bin/mapserv?
map=/home/lars/style_test/style_test.map
&SERVICE=WMS
&REQUEST=Getmap
&VERSION=1.1.1
&LAYERS=ST
&styles=color
&srs=EPSG:4326
&BBOX=0,0,20,15
&FORMAT=image/png
&WIDTH=200
&HEIGHT=150

http://localhost/cgi-bin/mapserv?
map=/home/lars/style_test/style_test.map
&SERVICE=WMS
&REQUEST=GetCapabilities
&VERSION=1.1.1

Have fun / Lars

15 september 2020 kl. 10:34, lars.schylberg at blixtmail.se skrev:

> Hi,
> 
> I had the same issue a couple a years ago and made some examples with the help from this list. 
> Please find this full example that I brushed up a little today.
> 
> https://gist.github.com/LarsSchy/d3a8285f4d06bc47ae358151048ed792
> 
> Best regards
> 
> Lars Schylberg
> 
> 15 september 2020 kl. 09:28, "Jörg Thomsen" <joerg.thomsen at wheregroup.com> skrev:
> 
>> Hi Matt,
>> 
>> this Mapfile
>> 
>> CLASSITEM "POPYTYPE"
>> CLASSGROUP 'grey'
>> CLASS
>> GROUP 'grey'
>> NAME "Grenze"
>> EXPRESSION /./
>> STYLE
>> OUTLINECOLOR 128 128 128
>> WIDTH 3
>> END
>> END
>> CLASS
>> GROUP 'red'
>> NAME "Grenze"
>> EXPRESSION /./
>> STYLE
>> OUTLINECOLOR 255 0 0
>> WIDTH 3
>> END
>> END
>> 
>> results in this capabilities:
>> 
>> <Layer queryable="0" opaque="0" cascaded="0">
>> <Name>Staatsgrenze</Name>
>> <Title>Staatsgrenze</Title>
>> ....
>> <Style>
>> <Name>grey</Name>
>> <Title>grey</Title>
>> <LegendURL width="59" height="20">
>> ...
>> </LegendURL>
>> </Style>
>> <Style>
>> <Name>red</Name>
>> <Title>red</Title>
>> <LegendURL width="59" height="20">
>> ...
>> </LegendURL>
>> </Style>
>> </Layer>
>> 
>> As in MapServer one symbol in the map can be the result of many combined
>> style-blocks in the mapfile, you cannot name the styles but you have to
>> use the claasgroup in the layer and the group-keyword within the the class.
>> 
>> You have to distinguish between the mapfile- and the capabilities-structure.
>> 
>> You only need the wms_style_default_ if you want other than the auto
>> genrated legend-symbols.
>> 
>> Jörg
>> 
>> Am 14.09.20 um 22:35 schrieb Cechini, Matthew F. (GSFC-423.0)[Science
>> Systems & Applications, Inc.]:
>> 
>>> I don't think that is creating the desired behavior. According the the WMS specification:
>>> 
>>> Zero or more Styles may be advertised for a Layer or collection of layers using <Style> elements,
>>> each of which shall have <Name> and <Title> elements.
>>> The style's Name is used in the Map request STYLES parameter.
>>> 
>>> Which would look like the following in the Capabilities document for a layer that has two styles:
>>> 
>>> <Layer queryable="0" opaque="0" cascaded="0">
>>> <Name>VIIRS_NOAA20_Thermal_Anomalies_375m_All</Name>
>>> <Title>Thermal Anomalies and Fires (375m, All, VIIRS, NOAA20)</Title>
>>> ...
>>> <Style>
>>> <Name>default</Name>
>>> <Title>default</Title>
>>> </Style>
>>> <Style>
>>> <Name>blue</Name>
>>> <Title>blue</Title>
>>> </Style>
>>> </Layer>
>>> 
>>> As far as I can tell/test, the CLASSGROUP configuration doesn't give me this desired behavior. Note
>>> also that the LAYER/METADATA has the following information, which presumably would be duplicated
>>> for each supported style:
>>> 
>>> "wms_style" "default"
>>> "wms_style_default_legendurl_width" "420"
>>> "wms_style_default_legendurl_height" "95"
>>> "wms_style_default_legendurl_format" "image/png"
>>> "wms_style_default_legendurl_href" "https://..../legends/.....png"
>>> 
>>> Thanks,
>>> Matt
>>> .................................................................
>>> Matthew Cechini
>>> Contractor, Science Systems and Applications, Inc.
>>> NASA GIBS Systems/Software Engineer
>>> 410.205.6272
>>> 
>>> On 9/14/20, 11:05 AM, "mapserver-users on behalf of Jörg Thomsen (WhereGroup)"
>>> <mapserver-users-bounces at lists.osgeo.org on behalf of joerg.thomsen at wheregroup.com> wrote:
>>> 
>>> I guess you are looking für classgroup:
>>> 
>>> LAYER
>>> ...
>>> CLASSGROUP "group1"
>>> ...
>>> CLASS
>>> NAME "name1"
>>> GROUP "group1"
>>> ...
>>> END
>>> 
>>> see
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__mapserver.org_mapfile_class.html&d=DwIGaQ&c=Apw
>>> owJNAKKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=OipIn4BZYBcdlsutC4b_bGavezJwpYfx1lCdvhPIEUg&m=ugMtvhucImNS
>>> kQeKIeO0NPhBwon8nGMIeDOOIfD5Y4&s=oclSQI0C1ThED5G6tbO2HojWNaYEeXUahlcUf1J3xr4&e=
>>> 
>>> Jörg
>>> 
>>> Am 14.09.20 um 16:56 schrieb Cechini, Matthew F. (GSFC-423.0)[Science
>>> Systems & Applications, Inc.]:
>> 
>> Unfortunately, that’s not the functionality that I’m looking for…
>> 
>> What I want is to support “&STYLES=default” or “&STYLES=blue” query
>> parameters resulting in different styling of the same underlying data.
>> 
>> Thanks,
>> 
>> Matt
>> 
>> .................................................................
>> 
>> Matthew Cechini
>> 
>> Contractor, Science Systems and Applications, Inc.
>> 
>> NASA GIBS Systems/Software Engineer
>> 
>> 410.205.6272
>> 
>> *From: *"Lime, Steve D (MNIT)" <steve.lime at state.mn.us>
>> *Date: *Monday, September 14, 2020 at 10:49 AM
>> *To: *Matthew Cechini <matthew.f.cechini at nasa.gov>,
>> "mapserver-users at lists.osgeo.org" <mapserver-users at lists.osgeo.org>
>> *Subject: *RE: [EXTERNAL] RE: Multiple Styles for a LAYER/CLASS
>> 
>> Names aren’t valid (or useful) at the style-level. If you remove those
>> lines it should work and you’ll get stacked styles for each feature. --Steve
>> 
>> *From:*Cechini, Matthew F. (GSFC-423.0)[Science Systems & Applications,
>> Inc.] <matthew.f.cechini at nasa.gov>
>> *Sent:* Monday, September 14, 2020 7:27 AM
>> *To:* Lime, Steve D (MNIT) <steve.lime at state.mn.us>;
>> mapserver-users at lists.osgeo.org
>> *Subject:* Re: [EXTERNAL] RE: Multiple Styles for a LAYER/CLASS
>> 
>> ------------------------------------------------------------------------
>> 
>> We’re using 7.0.1… admittedly a bit of an older version. Mapserver
>> balks on NAME in the STYLE element in that version.
>> 
>> Thanks,
>> 
>> Matt
>> 
>> .................................................................
>> 
>> Matthew Cechini
>> 
>> Contractor, Science Systems and Applications, Inc.
>> 
>> NASA GIBS Systems/Software Engineer
>> 
>> 410.205.6272
>> 
>> *From: *"Lime, Steve D (MNIT)" <steve.lime at state.mn.us
>> <steve.lime at state.mn.us>>
>> *Date: *Friday, September 11, 2020 at 5:17 PM
>> *To: *Matthew Cechini <matthew.f.cechini at nasa.gov
>> <matthew.f.cechini at nasa.gov>>, "mapserver-users at lists.osgeo.org
>> <mapserver-users at lists.osgeo.org>"
>> <mapserver-users at lists.osgeo.org <mapserver-users at lists.osgeo.org>>
>> *Subject: *[EXTERNAL] RE: Multiple Styles for a LAYER/CLASS
>> 
>> Hi Matt: Actually that syntax is supported (except for the style NAME
>> attribute) and you can have multiple styles inside a class. What version
>> are you using? --Steve
>> 
>> *From:*mapserver-users <mapserver-users-bounces at lists.osgeo.org
>> <mapserver-users-bounces at lists.osgeo.org>> *On Behalf Of
>> *Cechini, Matthew F. (GSFC-423.0)[Science Systems & Applications, Inc.]
>> *Sent:* Friday, September 11, 2020 2:37 PM
>> *To:* mapserver-users at lists.osgeo.org
>> <mapserver-users at lists.osgeo.org>
>> *Subject:* [mapserver-users] Multiple Styles for a LAYER/CLASS
>> 
>> ------------------------------------------------------------------------
>> 
>> Greetings,
>> 
>> I would like to provide multiple styles for the same LAYER/CLASS in
>> our mapserver configuration. Ideally that looks something like this,
>> though of course this syntax isn’t currently supported.
>> 
>> CLASS
>> 
>> NAME "Thermal Anomalies"
>> 
>> STYLE
>> 
>> NAME 'default'
>> 
>> SYMBOL 'circle'
>> 
>> COLOR 240 40 40
>> 
>> OUTLINECOLOR 240 40 40
>> 
>> SIZE 3
>> 
>> END
>> 
>> STYLE
>> 
>> NAME 'blue'
>> 
>> SYMBOL 'circle'
>> 
>> COLOR 0 0 255
>> 
>> OUTLINECOLOR 0 0 255
>> 
>> SIZE 3
>> 
>> END
>> 
>> END
>> 
>> How would I accomplish this given existing functionality?
>> 
>> Thanks,
>> 
>> Matt
>> 
>> .................................................................
>> 
>> Matthew Cechini
>> 
>> Contractor, Science Systems and Applications, Inc.
>> 
>> NASA GIBS Systems/Software Engineer
>> 
>> 410.205.6272
>> 
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> 
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.osgeo.org_mailman_listinfo_mapserver-2Dus
>>> rs&d=DwIGaQ&c=ApwzowJNAKKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=OipIn4BZYBcdlsutC4b_bGavezJwpYfx1lCdvhPI
>>> Ug&m=ugMtvhucImNS0kQeKIeO0NPhBwon8nGMIeDOOIfD5Y4&s=hP2umavasw6yoloBsKZQaLp-TqKJ97ehRA_MPRxtXWA&e=
>> 
>>> Viele Grüße,
>>> Jörg Thomsen
>>> 
>>> --
>>> ----------------------------------------------------------------------
>>> Aufwind durch Wissen!
>>> Jetzt neu: Web-Seminare und Online-Schulungen
>>> bei der
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.foss-2Dacademy.com&d=DwIGaQ&c=ApwzowJNAKKw3x
>>> e91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=OipIn4BZYBcdlsutC4b_bGavezJwpYfx1lCdvhPIEUg&m=ugMtvhucImNS0kQeKIeO0NP
>>> Bwon8nGMIeDOOIfD5Y4&s=0IjAFNhghml9HXpToQwMoHRBmVFaoRvVKMN4ftfvJhE&e=
>>> ----------------------------------------------------------------------
>>> 
>>> Jörg Thomsen
>>> WhereGroup GmbH
>>> Bundesallee 23
>>> 10717 Berlin
>>> Germany
>>> 
>>> Fon: +49 (0)30 / 5130 278 74
>>> Fax: +49 (0)30 / 5130 278 11
>>> 
>>> joerg.thomsen at wheregroup.com
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.wheregroup.com&d=DwIGaQ&c=ApwzowJNAKKw3xye91
>>> 7BE1XMRKi2LN9kiMk5Csz9Zk&r=OipIn4BZYBcdlsutC4b_bGavezJwpYfx1lCdvhPIEUg&m=ugMtvhucImNS0kQeKIeO0NPhBwo
>>> 8nGMIeDOOIfD5Y4&s=wnQQ5nHgsz5qm-sT5nizlY6IsV4Yferbyg5CXYFaEjI&e=
>>> 
>>> Geschäftsführer:
>>> Olaf Knopp, Peter Stamm
>>> Amtsgericht Bonn, HRB 9885
>>> 
>>> -------------------------------
>>> Folgen Sie der WhereGroup auf twitter:
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_WhereGroup-5Fcom&d=DwIGaQ&c=ApwzowJN
>>> KKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=OipIn4BZYBcdlsutC4b_bGavezJwpYfx1lCdvhPIEUg&m=ugMtvhucImNS0kQeK
>>> eO0NPhBwon8nGMIeDOOIfD5Y4&s=SlQSg0SzegOVriwtrrKsd6IcV1x4jojuX-rFllLWG98&e=
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.osgeo.org_mailman_listinfo_mapserver-2Dus
>>> rs&d=DwIGaQ&c=ApwzowJNAKKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=OipIn4BZYBcdlsutC4b_bGavezJwpYfx1lCdvhPI
>>> Ug&m=ugMtvhucImNS0kQeKIeO0NPhBwon8nGMIeDOOIfD5Y4&s=hP2umavasw6yoloBsKZQaLp-TqKJ97ehRA_MPRxtXWA&e=
>> 
>> Viele Grüße,
>> Jörg Thomsen
>> 
>> --
>> ----------------------------------------------------------------------
>> Aufwind durch Wissen!
>> Jetzt neu: Web-Seminare und Online-Schulungen
>> bei der www.foss-academy.com
>> ----------------------------------------------------------------------
>> 
>> Jörg Thomsen
>> WhereGroup GmbH
>> Bundesallee 23
>> 10717 Berlin
>> Germany
>> 
>> Fon: +49 (0)30 / 5130 278 74
>> Fax: +49 (0)30 / 5130 278 11
>> 
>> joerg.thomsen at wheregroup.com
>> www.wheregroup.com
>> 
>> Geschäftsführer:
>> Olaf Knopp, Peter Stamm
>> Amtsgericht Bonn, HRB 9885
>> 
>> -------------------------------
>> Folgen Sie der WhereGroup auf twitter: http://twitter.com/WhereGroup_com
>> 
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list