Opened 13 years ago

Last modified 13 years ago

#465 new enhancement

Rendering enhancement: user-defined palettes for PNG8

Reported by: jbirch Owned by:
Priority: medium Milestone:
Component: Rendering Service Version:
Severity: major Keywords:
Cc: External ID:


Now that MapGuide supports 8bit PNG, there is a use case for also supporting custom palettes. Both MapServer? and GeoServer? have implemented this functionality.

I haven't tested the experimental tiled PNG 8 support, but I have seen other implementations where small differences between the individually re-mapped tiles make the boundaries between the images visually distracting. Ensuring consistent tiles would be the primary incentive to add support for paletted images. However, there are potential benefits for non-tiled applications as well:

  • It may allow legend images to be transformed using a known palette so the legend actually matches the map.
  • If performance numbers are similar to the geoserver ones, some situations will see considerable performance gains: GeoServer Paletted Images
  • In some cases, this will allow carto-geeks more control over map presentation

I believe that an ideal implementation of this would allow for the use of separate palettes for each zoom level within a map or tiled map group.

Attachments (2)

Sheboygan MapDefinition Colors.html (12.6 KB) - added by zspitzer 13 years ago.
sample extract of palette used for sheboygan
Sheboygan.pal (231 bytes) - added by zspitzer 13 years ago.
Sheboygan JASC-PAL palette file

Download all attachments as: .zip

Change History (5)

comment:1 Changed 13 years ago by zspitzer

I can confirm that there is a problem with PNG8 tiles and compression

It should be possible to generate at least part of the palette simply by enumerating the layer styles within a given map definition

comment:2 Changed 13 years ago by jbirch

You start running into problems with this if you're using transparency or raster layers. I wonder if the number of cases where enumerating the styles wouldn't be sufficient is large enough that you'd want to avoid implementing it as a partial solution (raises more questions than it's worth?)

My preferred solution would be a tool that gridded the map at each visible scale range, visited each tile, and generated a custom palette for that scale range from the colours in those tiles. Hopefully, there would be a way of tweaking this so that commonly occurring colours don't totally exclude uncommon but important (nothing else close to them) colours.

comment:3 Changed 13 years ago by zspitzer

If the was to be a partial solution, the most obvious thing visually is fill colors for polygons.... that's where the differing palette problem is most visible

exploring this idea, it would be great to be have a CSS like style definition which would contain all the colors for a map.

Visiting each tile doesn't scale so well with larger maps. At the moment I am considering sticking to PNG and the post processing the tiles afterwards.

I'm gonna play with some xpath and see what i can extract

Changed 13 years ago by zspitzer

sample extract of palette used for sheboygan

Changed 13 years ago by zspitzer

Attachment: Sheboygan.pal added

Sheboygan JASC-PAL palette file

Note: See TracTickets for help on using tickets.