i have an example of a working label as described.  

looks like this for output

https://www.pwgeo.org/apps/compass/#xy=154857.26601255,567003.50321715,17.80183737240048&on=L167/all;L207/all;L117/all;L116/all;L280/all

i'm not in the office today though to get at it.

bobb

________________________________
From: mapserver-users <mapserver-users-boun...@lists.osgeo.org> on behalf of 
Schylberg Lars <lars.schylb...@saabgroup.com>
Sent: Monday, March 11, 2019 11:23:07 AM
To: Stephen Woodbridge; mapserver-users
Subject: Re: [mapserver-users] How to make label background transparent?

Hi again,

What happens if You skip the IMAGECOLOR statement ?
I did a project a year ago with a lot of transparent layers.
But I can't see that I used any IMAGECOLOR statements in that case.
I did however use predefined 256 color palettes for another reason.

/Lars

-----Original Message-----
From: mapserver-users <mapserver-users-boun...@lists.osgeo.org> On Behalf Of 
Stephen Woodbridge
Sent: den 11 mars 2019 16:25
To: lars.schylb...@blixtmail.se; mapserver-users 
<mapserver-users@lists.osgeo.org>
Subject: Re: [mapserver-users] How to make label background transparent?

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, lars.schylb...@blixtmail.se 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
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to