[mapserver-users] A problem about setting transparent raster layer.
Donald Kerr
donald.kerr at dkerr.co.uk
Thu Jul 18 03:26:00 PDT 2013
I have the following notes in my mapfile. Are they relevant?
In LAYER:
OFFSITE 255 255 255 # Transparent color - Also requires "TRANSPARENT ON" in
OUTPUTFORMAT
In OUTPUTFORMAT:
TRANSPARENT ON # Requires RGBA, not RGB. Also requires OFFSITE 255 255 255
in LAYER
==============
OUTPUTFORMAT
NAME "png"
DRIVER "AGG/PNG"
MIMETYPE "image/png"
IMAGEMODE "RGBA"
EXTENSION "png"
FORMATOPTION "GAMMA=0.75"
TRANSPARENT ON # Requires RGBA, not RGB. Also requires OFFSITE 255
255 255 in LAYER
END
=============
Regards,
Donald
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Guo YU
Sent: 18 July 2013 11:08
To: thomas bonfort
Cc: MapserverList OSGEO
Subject: Re: [mapserver-users] A problem about setting transparent raster
layer.
Thanks Thomas,
Set the Opacity on the Openlayer level works.
But on the Mapserver side, those changes still doesn't work. Anyway, the
problem is solved. Thanks.
On Thu, Jul 18, 2013 at 10:54 AM, thomas bonfort <thomas.bonfort at gmail.com>
wrote:
(please keep your messages on the list)
change pc256 to rgba in your mapfile.
add format:"image/png" to your openlayers options (same level as
alpha:true, which is not needed).
That said, there still very well could be a bug in the raster
classification code as opacity wasn't a first class citizen back in
the GD days....
as for client side opacity: add opacity:0.5 to your javascript (same
level as isBaseLayer)
--
thomas
On 18 July 2013 11:46, Guo YU <yuguo365 at gmail.com> wrote:
> Dear Thomas,
> Thanks for your reply.
> The mapserver I am using is from MS4W, so it is MS4W Setup Installer
> v3.0.6 (May 26, 2012).
> What Do you mean by use opacity at the client level? Where should I
> set it?
> I changed the driver from GD to AGG, but nothing changed.
>
> OUTPUTFORMAT
> NAME "png"
> MIMETYPE "image/png"
> DRIVER "AGG/PNG"
> EXTENSION "png"
> IMAGEMODE "PC256"
> TRANSPARENT on
> END
>
>
> On Thu, Jul 18, 2013 at 10:38 AM, thomas bonfort
<thomas.bonfort at gmail.com>
> wrote:
>>
>> Guo,
>>
>> Why not use opacity at the client level only ?
>> That said, this does seem like a bug. Can you specify which mapserver
>> version you are using, and which outputformat your are using (and if
>> you are using a GD one, try switching to AGG).
>>
>> --
>> thomas
>>
>>
>> On 18 July 2013 11:28, Guo YU <yuguo365 at gmail.com> wrote:
>> >
>> > Dear All,
>> > Since I need to show the code and figures about my problem, I
post
>> > it
>> > on the Stack Exchange.
>> > I got problem with Setting a Transparent Raster Layer and then show
this
>> > layer though OpenLayer.
>> >
>> > Here is the link :
>> >
>> >
http://gis.stackexchange.com/questions/66388/how-to-make-a-raster-layer-tran
sparent-via-mapserver
>> >
>> > Thanks for your time.
>> > --
>> > YU Guo
>> > MSc. Hydroinformatics and Water Management
>> > Email: yuguo365 at gmail.com
>> > Phone: +33 668 195803
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > mapserver-users mailing list
>> > mapserver-users at lists.osgeo.org
>> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> >
>
>
>
>
> --
> YU Guo
> MSc. Hydroinformatics and Water Management
> Email: yuguo365 at gmail.com
> Phone: +33 668 195803
>
>
>
--
YU Guo
MSc. Hydroinformatics and Water Management
Email: yuguo365 at gmail.com
Phone: +33 668 195803
More information about the MapServer-users
mailing list