[Tilesathome] Wrong colors in some tiles

Matthias Julius lists at julius-net.net
Fri Oct 24 18:33:51 BST 2008


Dirk Stöcker <openstreetmap at dstoecker.de> writes:

> Hello,
>
> when I look at some tiles, then they use totally wrong colors. One example 
> is http://tah.openstreetmap.org/Tiles/tile/12/2148/1418.png
>
> Now one could say this is an effect of the color reduction, but when I 
> look into the image, then I find multiple color entries with the same value, so 
> there must be an error somwhere in the processing chain which should be 
> found and fixed.

You are probably right and if it is a bug it is probably in pngnq.

I have plans and a partial implementation to use a color quantization
algorithm that ensures that all colors that are defined in the
osmarender styles and symbols remain unchanged.

This will work as follows:

- at startup of the client analyze all style files and symbols and
  store a color palette for each layer in memory

- use the appropriate color palette as base palette for each tile

- eliminate from that palette all colors that are not present on that
  tile

- quantize the rest of colors of that tile that are not already in the
  palette down to the number of colors needed to fill up the palette
  to 256 colors

- transform the tile using the new palette

This should prevent the deviation of all colors we really care about.
The only exception I can think of are those colors that result from
the use of less than 100% opaque colors in the styles that can be
virtually any color depending on the color underneath.  The accuracy
of all other colors which should only result from anti-aliasing is not
that important.

I am 3/4 there with my implementation.  It might take me a week or two
to get a first working version to be tested in _unstable.

Matthias




More information about the Tilesathome mailing list