COGReader.tile doesn't take into account mask band in some circumstances
See original GitHub issueThere is following set of files:
- masked.tif (with
PER_DATASET
internal mask) - data.vrt built based on masked.tif
- data.vrt.ovr (external overviews)
Let’s try to render a tile out of it:
In [1]: from rio_tiler.io import COGReader
In [2]: with COGReader("/tmp/test/data.vrt") as cog:
...: tile = cog.tile(2323, 3503, 13, tilesize=256)
...:
GDAL: GDALClose(/tmp/test/masked.tif, this=0x3699940)
GDAL: GDALClose(/tmp/test/data.vrt, this=0x3640b10)
In [3]: with open("/tmp/test/tile-ok.png", "wb") as dst:
...: dst.write(tile.render())
Expected result (screenshot from QGIS):
Actual result:
Everything is fine.
Now let’s try to render tile on a lower zoom level, in this case GDAL will use existing overviews.
In [1]: from rio_tiler.io import COGReader
In [2]: with COGReader("/tmp/test/data.vrt") as cog:
...: tile = cog.tile(72, 109, 8, tilesize=256)
...:
GDAL: GDALClose(/tmp/test/masked.tif, this=0x2f1f7e0)
GDAL: GDALClose(/tmp/test/data.vrt, this=0x20b6740)
GDAL: GDALClose(/tmp/test/data.vrt.ovr, this=0x2e51cc0)
In [3]: with open("/tmp/test/tile-nok.png", "wb") as dst:
...: dst.write(tile.render())
...:
Expected result:
Actual result:
As you can see the mask has not been taken into account.
Files that are being used: example.zip
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
#and I'm back in my original office for the first time in over a year!! I'm ...
Teasing by rubbing the head around your clit before dragging it down to your awaiting hole. Fingers shoving into your cunt again, he...
Read more >User friendly Rasterio plugin to read raster datasets.
rio-tiler was initialy designed to create slippy map tiles from ... COGReader.tile doesn't take into account mask band in some circumstances.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It did the trick!