[mapserver-users] FORMATOPTION "PALETTE_FORCE=TRUE" problem

thomas bonfort thomas.bonfort at gmail.com
Wed Jan 7 03:17:58 EST 2009


On Tue, Jan 6, 2009 at 20:25, paalkr <pal.kristensen at statkart.no> wrote:
>
> Hi Thomas,
>
> thanks for the quick answer! Applying ",255" at the end of every record in
> the palette.txt file worked, but when I made the WMS GetMap request I got an
> image in return where all the areas that should have been transparent where
> black (transparent=true). When using transparent=false I got an image in
> return where the "nodata" areas were filled with the bgcolor parameter
> value, which is of course the right response.
the quadruplet should represent the palette used by the end image, ie
the alpha value cannot just be set to 255. (e.g. to keep transparency,
one of the entries should be (0,0,0,0) ). you can have a look at
http://trac.osgeo.org/mapserver/ticket/2436 for some examples of how
to obtain this palette.

> The original palette.txt file with only r,g,b values caused the mentioned
> error message with both transparent=true and transparent=false, but I
> suspected it to work in the latter case.
are you sure you also got this with transparent=false ?


>
> Adding imagemode rgba didn't do any difference in any way. What exactly
> should the effect of adding this to the outputformat be?

outputformat with rgba:
 * used when a transparent background is needed
 * references a palette with r,g,b,a quadruplets

outputformat with rgb:
 * used when transparency isn't needed
 * references a palette with r,g,b triplets

regards,
thomas



>
>
> Regards,
> Pål Kristensen
>
>
> thomas bonfort wrote:
>>
>> are you calling this with a transparent=true ??
>> in that cas, your palette file should be a list of quadruplets
>> (r,g,b,a) (and it would be better to have an outputformat with
>> imagemode rgba, and use that one instead of passing transparent=true)
>>
>> thomas
>>
>> On Tue, Jan 6, 2009 at 15:56, paalkr <pal.kristensen at statkart.no> wrote:
>>>
>>> Hi!
>>>
>>> I have tried to use the FORMATOPTION "PALETTE_FORCE=TRUE" with no luck.
>>> I've
>>> goth this error message all the time:
>>>
>>> [Tue Jan  6 15:26:05 2009].409786 msDrawMap(): Layer 3 (N500Hoydelag),
>>> 0.161s
>>> [Tue Jan  6 15:26:05 2009].409998 msDrawMap(): Drawing Label Cache,
>>> 0.000s
>>> [Tue Jan  6 15:26:05 2009].410010 msDrawMap() total time: 0.170s
>>> [Tue Jan  6 15:26:05 2009].416062 Invalid number of colors in palette:
>>> Unable to access file. libpng error ()
>>> [Tue Jan  6 15:26:05 2009].416108 ms_png_write_image_init(): General
>>> error
>>> message. error writing png header (via longjmp)
>>> [Tue Jan  6 15:26:05 2009].416115 msSaveImageRGBAPalette(): General error
>>> message. error in png header writing
>>> [Tue Jan  6 15:26:05 2009].416122 msSaveImage() total time: 0.006s
>>> [Tue Jan  6 15:26:05 2009].416170 mapserv request processing time
>>> (msLoadMap
>>> not incl.): 0.177s
>>>
>>> My ouputformat is defined like this:
>>>
>>>   OUTPUTFORMAT
>>>      NAME "png8bit"
>>>      DRIVER "AGG/PNG"
>>>      MIMETYPE "image/png"
>>>      EXTENSION "png"
>>>      FORMATOPTION "PALETTE_FORCE=TRUE"
>>>      FORMATOPTION "PALETTE=/opt/maps/kartdata2/mapfiles/palette.txt"
>>>      FORMATOPTION INTERLACE=OFF
>>>   END
>>>
>>> The palette.txt file is attached
>>> http://n2.nabble.com/file/n2117781/palette.txt palette.txt
>>>
>>> Does anyone know whats wrong?
>>> BTW: This is MapServer 5.2.1 on RedHat.
>>>
>>> Regards,
>>> Pål Kristensen
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/FORMATOPTION-%22PALETTE_FORCE%3DTRUE%22-problem-tp2117781p2117781.html
>>> Sent from the Mapserver - User mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/FORMATOPTION-%22PALETTE_FORCE%3DTRUE%22-problem-tp2117781p2118972.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>


More information about the mapserver-users mailing list