Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hillshade WMS rendering no data and black values discrimination #300

Closed
micpilon opened this issue Jul 16, 2020 · 3 comments
Closed

Hillshade WMS rendering no data and black values discrimination #300

micpilon opened this issue Jul 16, 2020 · 3 comments

Comments

@micpilon
Copy link

Hillshade layer rendered with the default built-in style. All cells of value 0 gets rendered as transparent pixel in the resulting png file.
The desired output would be a rendering on which we could preserve black value and still get transparent background where cell value is nodata.

image

It seems that this bug is associated with the way renderPng assigns transparency to some bits on the 8-bit value range, including 0 (black).
See: https://github.com/locationtech/geotrellis/blob/master/raster/src/main/scala/geotrellis/raster/render/PngRenderMethods.scala#L56
https://github.com/geotrellis/geotrellis-server/blob/develop/ogc/src/main/scala/geotrellis/server/ogc/style/ColorRampStyle.scala

@pomadchin
Copy link
Member

I hope that this PR locationtech/geotrellis#3278 would cover this issue; I'll check it ASAP.

@pomadchin pomadchin self-assigned this Aug 1, 2020
@pomadchin
Copy link
Member

It looks like it can be a configuration issue with the color ramp application. Try the clamp-with-color = true setting in the layer.styles definitions!

@jfbourgon
Copy link

Indeed, it seems it was a configuration issue with the colorrampconf style.

Here are conf snippet and related output that confirm this.

No Clamp

{
                name = "greyscale-noclamp"
                title = "Greyscale Hillshade / Relief ombré en tons de gris (no clamp)"
                type = "colorrampconf"
                colors = ${color-ramps.greyscale}
                stops = 255
                legends = [
                    {
                        format = "image/png"
                        width = 36
                        height = 36
                        online-resource = {
                            type = "simple"
                            href = "https://datacube.services.geo.ca/canada-icon.png"
                        }
                    }
                ]
             }

Black values are rendered as transparent pixels and we can see the world imagery underneath.
image

Clamp

{
                name = "greyscale-clamp"
                title = "Greyscale Hillshade / Relief ombré en tons de gris (clamp)"
                type = "colorrampconf"
                colors = ${color-ramps.greyscale}
                stops = 255
                clamp-with-color = true
                legends = [
                    {
                        format = "image/png"
                        width = 36
                        height = 36
                        online-resource = {
                            type = "simple"
                            href = "https://datacube.services.geo.ca/canada-icon.png"
                        }
                    }
                ]
             }

Black values are rendered as opaque color as expected.
image

Thanks for letting us know about the clamp-with-color style property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants