mapnik wms postgis transparency

View: New views
4 Messages — Rating Filter:   Alert me  

mapnik wms postgis transparency

by Genis Pujol Hamelink-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello list,

I've created a wms service using mapnik with 2 layers.

One is being used as the base layer (using openlayers) and the 2nd one is a switchable layer on top of that (it displays a UTM grid).

The problem appears to be that the backgound of the 2nd layer (a grid) is color white instead of transparent, so it renders on top of the base layer...

I know I can set the opacity of the polygon to 0, but how can I set the background of the map to transparent?

Kind Regards,

G

_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: mapnik wms postgis transparency

by Jon Burgess-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-10-08 at 22:31 +0200, Genis Pujol Hamelink wrote:
> I know I can set the opacity of the polygon to 0, but how can I set
> the background of the map to transparent?

        <Map bgcolor="transparent" ...
or
        m.background = Color('transparent')

If you are using png256 format tiles then you may need to upgrade to a
newer version of Mapnik or switch to png. Old Mapnik versions would lose
the transparency when performing the conversion to 256 colours.

        Jon


_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: mapnik wms postgis transparency

by Dane Springmeyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Genis.

I think the way the WMS spec works to request a tranparent background  
tile you need to set up OpenLayers to send TRANSPARENT=true as one of  
you getMap request parameters. This is not the way Mapnik works but  
how the OgcServer implementation works.

Dane



On Oct 8, 2009, at 1:31 PM, Genis Pujol Hamelink  
<genis.pujol@...> wrote:

> Hello list,
>
> I've created a wms service using mapnik with 2 layers.
>
> One is being used as the base layer (using openlayers) and the 2nd  
> one is a switchable layer on top of that (it displays a UTM grid).
>
> The problem appears to be that the backgound of the 2nd layer (a  
> grid) is color white instead of transparent, so it renders on top of  
> the base layer...
>
> I know I can set the opacity of the polygon to 0, but how can I set  
> the background of the map to transparent?
>
> Kind Regards,
>
> G
> _______________________________________________
> Mapnik-users mailing list
> Mapnik-users@...
> https://lists.berlios.de/mailman/listinfo/mapnik-users
_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Parent Message unknown Re: mapnik wms postgis transparency

by Dane Springmeyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Genis,

That is great news that upgrading fixed the problem.

Dane


On Oct 10, 2009, at 12:08 PM, Genís Pujol Hamelink wrote:

Hello,

Thanks for the feedback :)

With mapnik version 6.0.0 the code doesn't work, but with 6.0.1 version everything works OK :)

kind regards,

G

2009/10/10 Dane Springmeyer <blake@...>
Hmm,

That is odd, it works fine for me. I don't have time to test your setup, but I modified the examples at:


to include transparent tiles for the labels. 

See the OpenLayers example here:

See the mapfile here:

And the 'map_factory' here:


I ran the server in python standalone mode using:


Does that work for you?

If not, can you confirm your mapnik version and maybe post a bit of sample data?

Dane


On Oct 9, 2009, at 2:00 AM, Genís Pujol Hamelink wrote:

Hello,

I've put the code for the mapnik wms here: http://dpaste.com/104816/

I call it from Openlayers with this function:

var baselayer = new OpenLayers.Layer.WMS( "Base layer","http://localhost:9012", {layers: 'shire}, {'displayInLayerSwitcher':true} );
           
            var layer = new OpenLayers.Layer.WMS( "UTM grid 10x10","http://localhost:9012", {layers: 'UTM10X10',transparent:'TRUE'}, {'isBaseLayer':false,'displayInLayerSwitcher':true} );
            map.addLayers([baselayer,layer]);
          
IF I add the parameter 'transparent': TRUE, the background is black, if I don't then it's white.

Is it possible to get a transparent background using mapnik's ogcfeatures?

kind regards,

G


2009/10/9 Dane Springmeyer <blake@...>
Hello Genis.

I think the way the WMS spec works to request a tranparent background tile you need to set up OpenLayers to send TRANSPARENT=true as one of you getMap request parameters. This is not the way Mapnik works but how the OgcServer implementation works.

Dane




On Oct 8, 2009, at 1:31 PM, Genis Pujol Hamelink <genis.pujol@...> wrote:

Hello list,

I've created a wms service using mapnik with 2 layers.

One is being used as the base layer (using openlayers) and the 2nd one is a switchable layer on top of that (it displays a UTM grid).

The problem appears to be that the backgound of the 2nd layer (a grid) is color white instead of transparent, so it renders on top of the base layer...

I know I can set the opacity of the polygon to 0, but how can I set the background of the map to transparent?

Kind Regards,

G
_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users



--
Genís




--
Genís


_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users