[mapserver-users] Re: Use of palette file: Problems with changingcolors when tiling
Stephen Woodbridge
woodbri at swoodbridge.com
Fri Nov 6 11:09:42 PST 2009
Ahh, in my example I removed "PALETTE_FORCE=TRUE" because I confused it
with "QUANTIZE_FORCE=ON".
I assume you can both force the palette and quantize at the same time?
Are "TRUE" and "ON" equivalent as far as FORMATOPTIONs go? I'm going to
guess not because I think these are NOT getting parsed by the mapfile
parser and are more likely getting parsed by the individual drivers.
-Steve W
Steve Lime wrote:
> Correct. My palette creation process has been to:
>
> 1) create a master image that shows as many possible rendering
> outputs as possible as a 24-bit PNG.
>
> 2) use a tool to reduce the colors in that image to the desired
> number and create a 8-bit file. In my case I use PhotoShop and
> produce a gif. Here's a link to the one I used for our rec. compass
> app but after color reduction to 128 colors.
>
> http://maps.dnr.state.mn.us/compass/remove/compass_color_master.gif
>
> 3) extract a palette from the 8-bit image. I wrote a little perl
> script that processes gdalinfo output.
>
> 4) my outputformat block is like so:
>
> OUTPUTFORMAT NAME png
> DRIVER "AGG/PNG"
> MIMETYPE "image/png"
> IMAGEMODE RGB
> EXTENSION "png"
> FORMATOPTION "INTERLACE=OFF"
> FORMATOPTION "PALETTE_FORCE=TRUE"
> FORMATOPTION "PALETTE=/mapserver/compass/compass.palette"
> END
>
> I've not had problems with this method...
>
> It's possible there's a bug but it's going to be difficult to fix
> without a good test case.
>
> Steve
>
>>>> On 11/6/2009 at 9:52 AM, in message
> <a4cd3760911060752i609ad757g9872b8ff5a9b5c27 at mail.gmail.com>, Espen
> Isaksen <espen.isaksen at gmail.com> wrote:
>> Sorry, this still creates trouble. And you have omitted
>>
>> FORMATOPTION "PALETTE_FORCE=TRUE"
>>
>> on this one. That means it does not use the palette file right?
>>
>> Espen
>>
>>
>> 2009/11/6 Stephen Woodbridge <woodbri at swoodbridge.com>:
>>> Espen,
>>>
>>> Try using this:
>>>
>>> OUTPUTFORMAT NAME agg DRIVER "AGG/PNG" MIMETYPE "image/png"
>>> IMAGEMODE RGB FORMATOPTION "INTERLACE=false" FORMATOPTION
>>> "QUANTIZE_FORCE=ON" FORMATOPTION "QUANTIZE_DITHER=OFF"
>>> FORMATOPTION "QUANTIZE_COLORS=256" FORMATOPTION
>>> "PALETTE=/data/maps/palette.txt" END
>>>
>>> And see if it does what you want. Also note that I use "ON" and
>>> note "TRUE" as the value of "QUANTIZE_FORCE", but I'm not sure if
>>> the matters or not.
>>>
>>> -Steve
>>>
>>> Espen Isaksen wrote:
>>>> Yes, that is what we have been doing all along. I guess I never
>>>> should have mentioned our testing with putting lots of colors
>>>> in the palette file, as it just confuses people :-)
>>>>
>>>> So forget our testing, we have only put the colors we use in
>>>> the mapfile once in the palette file(attached in the first
>>>> mail), and the error in the color is like on the map I
>>>> attached(first mail).
>>>>
>>>> Espen
>>>>
>>>>
>>>>
>>>> 2009/11/6 Thomas Bonfort <thomas.bonfort at camptocamp.com>:
>>>>> Stephen Woodbridge replied to this thread, and gave the
>>>>> correct usage of the palette file: set the same colors in
>>>>> your palette file as in your mapfile.
>>>>>
>>>>> regards,
>>>>>
>>>>> thomas
>>>>>
>>>>> www.camptocamp.com +33 5 16 57 01 02
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Nov 6, 2009 at 14:24, Espen Isaksen
>>>>> <espen.isaksen at gmail.com> wrote:
>>>>>> Justed wanted to bring this question into attention again
>>>>>> since we did not get a solution to the problem, and we have
>>>>>> not found one either.
>>>>>>
>>>>>> Could this possibly be a bug in Mapserver? Should we report
>>>>>> it?
>>>>>>
>>>>>> Espen
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2009/10/28 Espen Isaksen <espen.isaksen at gmail.com>:
>>>>>>> Hi!
>>>>>>>
>>>>>>> We are testing out using a palette file in our
>>>>>>> outputformat to decrease file size in the png output.
>>>>>>> Most of the time this works great, but some times when we
>>>>>>> are tiling the data we get some errors. The color seem to
>>>>>>> shift to a similar color from one tile to another.
>>>>>>>
>>>>>>> We have added the colors we use in the map file in the
>>>>>>> palette.txt file. The documentation says it needs 256
>>>>>>> colors in the map file, but we do not use that many
>>>>>>> colors right now. (we tried adding the same color more
>>>>>>> than one time, but that created other problems....)
>>>>>>>
>>>>>>> I have attached a png file showing the problem across a
>>>>>>> lake. The color on the right side is the correct color
>>>>>>> and the color we have added to the palette file. The
>>>>>>> color on the left side of the lake is not something we
>>>>>>> have set.
>>>>>>>
>>>>>>> I have also added the palette.txt file and the
>>>>>>> outputformat we use is this:
>>>>>>>
>>>>>>> OUTPUTFORMAT NAME "png" DRIVER
>>>>>>> "AGG/PNG" MIMETYPE "image/png" IMAGEMODE
>>>>>>> "rgb" EXTENSION "png" FORMATOPTION
>>>>>>> "PALETTE_FORCE=TRUE" FORMATOPTION
>>>>>>> "PALETTE=/data/maps/palette.txt" END
>>>>>>>
>>>>>>> Does anybody know why this happens in Mapserver and how
>>>>>>> to fix it?
>>>>>>>
>>>>>>> Espen
>>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>
>> _______________________________________________ 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