[MapProxy] transparency with a WMS layer

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Fri Feb 24 15:57:42 EST 2012


Hi

I have believed that jpeg does not support transparency but does OpenLayers handle it with some special system?

> "effis_hotspots", format: 'image/jpeg', transparent: "true"},,

-Jukka Rahkonen-

________________________________________
Oliver Tonnhofer wrote:

Hi,

On 24.02.2012, at 17:41, Paolo Corti wrote:
> Here is my problem: I have a WMS layer, from MapServer, defined in the
> yaml file in this way:
>
> sources:
>  hotspots_wms:
>    type: wms
>    req:
>      url: http://localhost/mapserver/global?
>      layers: hotspots
>      transparent: true
>      map: /path/to/my/mapfile.map
>      transparent: true
>      image:
>        transparent_color: '#ffffff'
>        transparent_color_tolerance: 20

The image options do not belong to req, you need to unindent it one step. But you don't need this option if your MapServer already returns transparent images (which it does).


> With OpenLayers this is how I have defined the layer:
> […]
>    var mapproxy_layer = new OpenLayers.Layer.WMS( "MapProxy Hotspots",
>            "http://localhost:8081/service?", {layers:
> "effis_hotspots", format: 'image/jpeg'},
>            mapproxy_params );

You need to tell OpenLayer that this layer it transparent:

>    var mapproxy_layer = new OpenLayers.Layer.WMS( "MapProxy Hotspots",
>            "http://localhost:8081/service?", {layers:
> "effis_hotspots", format: 'image/jpeg', transparent: "true"},
>            mapproxy_params );



> It seems that the transparency of the layers is lost, and white has
> became the background color.
> Any idea about what is going wrong with this?
> I have seen a couple of threads about opacity problems, but not sure
> they are related to my problem.


The WMS option `transparent` defaults to false and the background is then set to the value of the WMS `bgcolor` option, which is white.

Regards,
Oliver

--
Oliver Tonnhofer    | Omniscale GmbH & Co KG    | http://omniscale.de
http://mapproxy.org | https://bitbucket.org/olt | @oltonn


_______________________________________________
MapProxy mailing list
MapProxy at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapproxy


More information about the MapProxy mailing list