[MapProxy] transparency with a WMS layer

Paolo Corti pcorti at gmail.com
Fri Feb 24 11:41:01 EST 2012


Hello folks

please be patient with me as I am totally new to this MapProxy cool stuff :)

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

With OpenLayers this is how I have defined the layer:

    var mapproxy_params = {
        projection: new OpenLayers.Projection("EPSG:900913"),
        units: "m",
        maxResolution: 156543.0339,
        maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34),
        opacity: 0.5,
        singleTile: true,
        ratio: 1,
        isBaseLayer: false
    };
    var mapproxy_layer = new OpenLayers.Layer.WMS( "MapProxy Hotspots",
            "http://localhost:8081/service?", {layers:
"effis_hotspots", format: 'image/jpeg'},
            mapproxy_params );

This is how the layer is rendered from WMS, without MapProxy:
http://dl.dropbox.com/u/512462/gis/without_mapproxy.png

And this is how the layer is rendered with MapProxy:
http://dl.dropbox.com/u/512462/gis/with_mapproxy.png

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.

I have tried to change parameter values both in yaml file (adding
transparent_color and transparent_color_tolerance) and in OpenLayers
layer (opacity), but not success until now.

Thanks so much
P


-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti


More information about the MapProxy mailing list