[MapServer-users] Changing opacity of one layer in a multilayer WMS request URL with MapServer 8

Matthew Graber grabermtw at gmail.com
Wed Feb 22 11:59:28 PST 2023


Hi all,

Thanks for your help! I was able to get the SLD_BODY WMS parameter to serve
as a workaround for setting opacity. In case anyone else has this problem,
the SLD I used in this case was:

<StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld"
version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="
http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml">

<NamedLayer>

<Name>test_b</Name>

<UserStyle>

<FeatureTypeStyle>

<Rule>

<Name>default</Name>

<RasterSymbolizer>

<Opacity>0.5</Opacity>

</RasterSymbolizer>

</Rule>

</FeatureTypeStyle>

</UserStyle>

</NamedLayer>

</StyledLayerDescriptor>

Appreciate everyone's help!
-Matt

On Wed, Feb 22, 2023 at 11:51 AM Rahkonen Jukka <
jukka.rahkonen at maanmittauslaitos.fi> wrote:

> Hi,
>
>
>
> About the SLD, opacity appears in stroke, fill, graphic, and raster in SLD
> 1.0.
>
>
>
> -Jukka Rahkonen-
>
>
>
> *Lähettäjä:* MapServer-users <mapserver-users-bounces at lists.osgeo.org> *Puolesta
> *Steve Lime
> *Lähetetty:* keskiviikko 22. helmikuuta 2023 17.47
> *Vastaanottaja:* Matthew Graber <grabermtw at gmail.com>
> *Kopio:* mapserver-users at lists.osgeo.org
> *Aihe:* Re: [MapServer-users] Changing opacity of one layer in a
> multilayer WMS request URL with MapServer 8
>
>
>
> Hi Matthew: That functionality was indeed removed as part of 8.0. I kind
> of expect that we might build back something for more limited use cases if
> necessary, Does SLD support opacity/transparency?
>
>
>
> --Steve
>
>
>
>
>
> On Tue, Feb 21, 2023 at 10:52 AM Matthew Graber <grabermtw at gmail.com>
> wrote:
>
> Hello all!
>
>
>
> With MapServer 8, I'm wondering what the proper way to change the opacity
> of a single layer in a multilayer WMS request is.
>
>
>
> For example, the following URL excerpt shows the old way of accomplishing
> this that worked while using MapServer 7:
>
>
>
>
> SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&LAYERS=test_a,test_b&map.layer[test_b]=OPACITY+50
>
>
>
> My understanding is that this would have the same effect as adding
> "OPACITY 50" to the test_b layer in the mapfile. The mapfile containing
> test_a and test_b did not have OPACITY included when they were written.
> Obviously, this no longer works with MapServer 8, and now that request has
> the same results as omitting the "&map.layer[test_b]=OPACITY+50" portion
> entirely.
>
>
>
> Based on https://mapserver.org/fr/MIGRATION_GUIDE.html
> <https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Ffr%2FMIGRATION_GUIDE.html&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C751680624f65498df41008db14ec07c5%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638126776216198394%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CbH%2FfRUQdX9uq8H9QRy48X0BggqTStn4IDQR4jD%2B97Y%3D&reserved=0>,
> I see that OPACITY now belongs inside a COMPOSITE object. I tried the
> following modifications to the request URL:
>
>
>
>
> SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&LAYERS=test_a,test_b&map.layer[test_b].composite=OPACITY+50
>
>
> SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&LAYERS=test_a,test_b&map.layer[test_b].composite[0]=OPACITY+50
>
>
>
> I also tried this both with the mapfile left as-is, and with an empty
> COMPOSITE object being included in each layer object, and each time I got
> the same unsuccessful result as before.
>
>
>
> Is there a way to accomplish this in MapServer 8?
>
>
>
> Also, does this map.layer[layername]=... syntax still work in MapServer 8?
> The documentation at
> https://mapserver.org/cgi/controls.html#using-mapserver-version-8
> <https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Fcgi%2Fcontrols.html%23using-mapserver-version-8&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C751680624f65498df41008db14ec07c5%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638126776216198394%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=nu1%2BBml9%2BZG%2BIvjJ8ZpRZ28kDVKzo960hSM%2F18s3Jng%3D&reserved=0>
> suggests it might no longer work for MapServer 8 (based on the heading
> "Using MapServer version < 8"), but the documentation at
> https://mapserver.org/pdf/MapServer.pdf
> <https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Fpdf%2FMapServer.pdf&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C751680624f65498df41008db14ec07c5%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638126776216198394%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OGoZ%2FK4IwX1%2FVRmcWsewiygoys24Vg4eDlGYIhtdcUk%3D&reserved=0>
> shows the same examples with the heading "Using MapServer version <= 8" on
> page 1065 of the PDF, so I'm unsure if this is still intended to work in
> MapServer 8.
>
>
>
> Thank you,
>
> Matt
>
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
> <https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fmapserver-users&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C751680624f65498df41008db14ec07c5%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638126776216198394%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=TonNCCvW%2FnZX%2FbNTKWsiKeXfFWrMMGXP3KnLTlUjDmA%3D&reserved=0>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20230222/f9bebb56/attachment.htm>


More information about the MapServer-users mailing list