Search code examples
geoserverwms

WMS service output tiles with more then 255 Colors


The default Geoserver WMS implementation allows an output of png tiles with up to 256 Colors defined by a SLD style definition.

In conjunction with a GLSL approach to color tiles client side, I want to render tiles with more then 255 colors. Instead using the full RGB range (256 * 256 * 256) is what would be needed.

Is Geoserver or an alternative Tile generating server solution able to render 24 bit png images?


Solution

  • When I download the PNG from my GeoServer, it has RGB color profile:

    curl -o layer.png http://localhost:8080/geoserver/test/wms?service=WMS&version=1.1.0&request=GetMap&layers=test%3Amunicipalities&bbox=498306.7970000002%2C5235854.617999479%2C855882.5630006271%2C5602020.779999593&width=749&height=768&srs=EPSG%3A25832&styles=&format=image%2Fpng
    
    gdalinfo layer.png
    [...]
    Band 1 Block=749x1 Type=Byte, ColorInterp=Red
    Band 2 Block=749x1 Type=Byte, ColorInterp=Green
    Band 3 Block=749x1 Type=Byte, ColorInterp=Blue
    

    Only when I explicitly request format=image/png8, I get a 1 Byte paletted PNG:

    gdalinfo layer8.png
    [...]
    Band 1 Block=749x1 Type=Byte, ColorInterp=Palette
      Color Table (RGB with 255 entries)
        0: 0,0,0,255
    [...]
      254: 255,255,255,255
    

    You can also request format=image/tiff if that helps you more. See WMS output formats documentation for the full list.

    Lastly, would it help you to request vector tiles and do the rendering completely on the client side?