Trouble Hiding NoData Value #643
-
Hello there! I just started experimenting with titiler yesterday and have made great progress in a rather short amount of time (deploying it to the cloud, rendering tiles in a variety of web mapping libraries, etc)! However, I can't seem to generate tiles that respect our In QGIS, it seems to automatically 'know' this value and drops it from view. Similarly, when using the same COG image outside of Titiler and directly from the source - I'm able to tell OpenLayers what the value is and have it appropriately remove it from the scene. I've also tried adding Attached is a > gdalinfo out.tif
Driver: GTiff/GeoTIFF
Files: out.tif
Size is 11557, 10545
Coordinate System is:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4326"]]
Pixel Size = (0.000000141738231,-0.000000141738231)
Metadata:
AREA_OR_POINT=Area
OVR_RESAMPLING_ALG=NEAREST
Image Structure Metadata:
COMPRESSION=DEFLATE
INTERLEAVE=PIXEL
Band 1 Block=512x512 Type=Float32, ColorInterp=Blue
Description = Band1
NoData Value=-10000
Overviews: 5779x5273, 2890x2637, 1445x1319, 723x660, 362x330
Band 2 Block=512x512 Type=Float32, ColorInterp=Green
Description = Band2
NoData Value=-10000
Overviews: 5779x5273, 2890x2637, 1445x1319, 723x660, 362x330
Band 3 Block=512x512 Type=Float32, ColorInterp=Red
Description = Band3
NoData Value=-10000
Overviews: 5779x5273, 2890x2637, 1445x1319, 723x660, 362x330
Band 4 Block=512x512 Type=Float32, ColorInterp=Undefined
Description = Band4
NoData Value=-10000
Overviews: 5779x5273, 2890x2637, 1445x1319, 723x660, 362x330
Band 5 Block=512x512 Type=Float32, ColorInterp=Undefined
Description = Band5
NoData Value=-10000
Overviews: 5779x5273, 2890x2637, 1445x1319, 723x660, 362x330
Band 6 Block=512x512 Type=Float32, ColorInterp=Undefined
Description = Band6
NoData Value=-10000
Overviews: 5779x5273, 2890x2637, 1445x1319, 723x660, 362x330
Band 7 Block=512x512 Type=Float32, ColorInterp=Undefined
Description = Band7
NoData Value=-10000
Overviews: 5779x5273, 2890x2637, 1445x1319, 723x660, 362x330 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Without access to the file it will be pretty hard for me to help. If there is an issue, it will be in the rio-tiler side anyway. TO debug this you could just try to play with rio-tiler from rio_tiler.io import Reader
with Reader("my.tif") as src:
im = src.preview(indexes=1) # Read the first band
data = im.data
mask = im.mask #<-- this is the part you want to check to make sure the nodata is used to create the mask Note: we are currently working on the next version of rio-tiler which change a lot of things for the mask creation (switch from a per-dataset to a per-band mask) and also fixing some issue when working with GCPS referenced files. |
Beta Was this translation helpful? Give feedback.
-
Perhaps asking this another way - in hopes I'm not misunderstanding what the mask does. Does/can the mask provide a transparent 'value' similar to when a tile is at edge of the actual image. Basically, I'm hoping that the black area which represents |
Beta Was this translation helpful? Give feedback.
after inspecting the data I think I know what's going on!
The band 6 and 7 do not have the same
nodata
mask. Their value is set to0
while the other bands are at-10000
Sadly the current version of rio-tiler use a
per-dataset
mask, meaning that it will construct a mask using thesum
of all the mask, and because the band 6 and 7 says it shouldn't mask the area on the right of the image, the combined mask return 255 instead of 0.https://github.com/cogeotiff/rio-tiler/blob/main/rio_tiler/reader.py#L197-L202
Next version of rio-tiler will use
per-band mask
so it should better handle this case (ref: cogeotiff/rio-tiler#579)https://github.com/cogeotiff/rio-tiler/blob/30dc83cdc3154ac2820363d3…