Opened 5 years ago
Last modified 18 months ago
#2256 assigned enhancement
WMS should adapt null values for non-char data
Reported by: | Bang Pham Huu | Owned by: | Dimitar Misev |
---|---|---|---|
Priority: | trivial | Milestone: | Future |
Component: | petascope | Version: | development |
Keywords: | Cc: | Dimitar Misev, Vlad Merticariu | |
Complexity: | Medium |
Description
When having data that is not of type char requested in png or jpeg, a data type conversion happens. However, the null value that WMS uses in the encode function of the rasql statement it generates is still the original null value, which breaks transparency.
Example:
- satellite image layer S has type uint16 and null value -999.
- S is visualized in WMS, WMS executes rasql queries of the following form:
select encode(c[0:255,0:255], "png", "nodata=-999")
- because the output is png, this is implicitly converted to char and -999 is changed to a value in the char range.
- the final result of the query contains black pixels which are not treated as transparent because WMS told the encoder to treat -999 as transparent.
To fix:
- find out how the conversion to char works in the png / jpeg encoder
- apply it to the null value in WMS
Example:
- if in the case above, -999 is changed to 0, the query should be:
select encode(c[0:255,0:255], "png", "nodata=0")
Change History (4)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
satellite image layer S has type uint16 and null value -999.
However, this null value (-999) is wrong. In the value set of uint16 (0 - 65535) there are no values that are -999, hence no null values at all.
comment:3 by , 3 years ago
Milestone: | 10.0 → Future |
---|---|
Priority: | major → trivial |
Version: | 9.8 → development |
comment:4 by , 18 months ago
Owner: | changed from | to
---|
I think this ticket is much correct to solve in rasdaman instead of petascope. It should be generic in encode()
in rasql, not only for WMS.
This is a tricky problem as it depends on how formats handle non-char datatypes. Fixing it would require to fix the list of formats supported I think.
If you cast explicitly to (char) before encoding, then rasdaman will cast the -999 to 0. But also -2 will cast to 0, so we are conflating null and non-null values.
If the null value handling is implemented with masks instead of sets, it could improve the situation, especially for PNG as the mask becomes a separate channel. But not so much for other formats like jpeg, as then we have again a problem of choosing a null value out of the values set.