[Mapserver-users] Transparency not working for inline layers

Paul Spencer spencer at dmsolutions.ca
Tue Jan 21 07:37:45 EST 2003


Nyon, not sure if this will help with your particular application, but 
we developed a similiar capability by drawing each layer individually 
and setting the up the transparency manually.  I don't have the code on 
hand, but it used this kind of logic (this code isn't tested and could 
be way off, but this is what I remember. ;)):

$mapImg = $mapObj->prepareImage();
for($i=0;$i<$mapObj->numlayers;$i++)
{
     $layerObj = $mapObj->getlayer( $i );
     $layerImg = $mapObj->prepareImage();
     $layerObj->draw( $layerImg );
     if ($i == $maskLayer)
     {
          //assume that we have set up the layer to mask previous layers
          $mapImg->pasteImage( $layerImg, $black );
     }
     else
     {
          $mapImg->pasteImage( $layerImg, $white );
     }
}

This assumes that the normal transparent color on layers is $white and 
that on the mask layer, you have drawn your mask feature in $black. 
When you paste it, the $black part is transparent and the rest of the 
layer becomes white.

Because you draw the layers yourself, you can use this method to mask 
any set of layers regardless of the location of the layers or the mask 
layer.  This was one of our requirements (the user could pick the layers 
to mask).


YC Nyon wrote:
> I want to draw a circle as a buffer for some spatial queries. Done that.
> However, I need it displayed as transparent, so the rest of the features
> (ie. buildings) 'comes' through. Transparency is supported by my PHP-MS
> version (tested successfully). Moving the 'circle' layer up and down the
> mapfile didn't work. Can anyone confirm whether transparency is supported by
> inline layers.
> 
> Attached is the image.
> 
> TIA
> Nyon
> 
> 
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.443 / Virus Database: 248 - Release Date: 11/01/2003
> 
> 
> ------------------------------------------------------------------------
> 

-- 
Paul Spencer
Applications and Software Development
DM Solutions Group Inc.
http://www.dmsolutions.ca





More information about the mapserver-users mailing list