[mapserver-users] How to make label background transparent?

Stephen Woodbridge stephenwoodbridge37 at gmail.com
Fri Mar 8 19:07:09 PST 2019


I found that I can set the color -1 -1 -1 to make the color transparent, 
but this does not seem to overwrite the existing colors already drawn in 
the image. I suspect that the drawing in white is allocating a 2nd color 
white in the color table where only the first one is being set to 
transparent. I would be nice if we had a way to specify that the color 
being written should be the background color and therefore will be 
transparent.

So adding this to the label:

       STYLE
         GEOMTRANSFORM 'labelpoly'
         COLOR -1 -1 -1
       END

basically does nothing. IE: the labelpoly is not written at all.

-Steve W

On 3/8/2019 9:16 PM, Stephen Woodbridge wrote:
> Hi All,
>
> I have a mapfile with:
>
> MAP IMAGECOLOR 255 255 255
>
> and LAYER with:
>
>   CLASS
>     STYLE
>       COLOR "#000000"
>       WIDTH 1
>     END
>     LABEL
>       STYLE
>         GEOMTRANSFORM 'labelpoly'
>         COLOR 255 255 255
>       END
>       TEXT (tostring([DEG_F], "%.1f"))
>       TYPE TRUETYPE
>       FONT "arial"
>       SIZE 10
>       COLOR '#000000'
>       #OUTLINECOLOR '#ffffff'
>       #OUTLINEWIDTH 5
>       MINDISTANCE 250
>       MAXSCALEDENOM 1000000
>       BUFFER 5
>       REPEATDISTANCE 250
>       PARTIALS FALSE
>     END
>   END
>
> The mapfile is for contour lines and I want to label them and break 
> the contour line by setting the labelploy to the MAP IMAGECOLOR so it 
> becomes transparent. Only the above is making the label poly white and 
> not transparent :(
>
> How can I do this?
>
> -Steve W
>
> MapServer version 7.0.0 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML 
> SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO 
> SUPPORTS=SVG_SYMBOLS SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI 
> SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER 
> SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER 
> SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG 
> INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
>


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



More information about the mapserver-users mailing list