Re: How to make label background transparent?

Stephen Woodbridge <[email protected]>
Newsgroups gmane.comp.gis.mapserver.user
Message-ID <[email protected]>
Hi Lars,

Thank you for the feedback on this. Let me clarify what I'm trying to 
do. I have a shape file with contour lines in it. I drawing this as an 
overlay image so the background is transparent. In the mapfile the 
IMAGECOLOR sets the background color and this is the color that is 
identified as transparent. So in a PNG image the background color is set 
in the first slot of the color table and marked as transparent. In my 
case this is color #ffffff, but if I create labelpoly and assign it as 
#ffffff then another slot in the color table is allocated and assigned 
the color #ffffff but not the first slot that was allocated for the 
background, so it shows up as white.

In my image I have a contour line drawn and when it is labeled the 
contour line goes through the text of the label. If I use the labelpoly 
then a white background for the label is shown hiding the contour line. 
This is what I want to happen only I want the labelpoly color to be the 
same color slot as the background color to it hides the contour line 
behind the label like the white case but is transparent instead of 
white. IE: it needs to write the label poly with the first slot color, 
not the new white color slot.

I think, setting the COLOR -1 -1 -1 was intended to do this, but maybe not.

Attached are two small images:

contour.png - shows the contour line through the label text with 
labelpoly color #FFFFFF00 or color -1 -1 -1
contour-white.png - show labelpoly color #FFFFFF

-Steve W

On 3/11/2019 5:25 AM, [email protected] wrote:
> Hi Steve,
>
> I am not sure what your use of IMAGECOLOR has to do here.  Normally I have some layers in between the
> background and the elevation lines.
>
> But there are two more ways do get the color to be transparent in Mapserver:
>
> STYLE
>    GEOMTRANSFORM 'labelpoly'
>    COLOR "#ffffff00"
> END
>
> or
>
> STYLE
>    GEOMTRANSFORM 'labelpoly'
>    COLOR 255 255 255
>    OPACITY 0
> END
>
>
> But those are doing the same thing as your solution below with COLOR -1 -1 -1
>
> Maybe You are after some of the potential techniques that Thomas talked about a couple of years ago with
> layer blending with the label cache. Those were some future techniques that could be added to the
> layer composite pipeline if anyone was interested.
>
> Best regards
>
> Lars Schylberg



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
mapserver-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
contour.png (image/png, 3.2 KB) - not displayed
contour-white.png (image/png, 2.4 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.