-
Notifications
You must be signed in to change notification settings - Fork 108
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
.tile() is not masking region outside of image when nodata used #675
Comments
@banesullivan interesting this is related to #669 where we removed WarpedVRT for nodata handling. We know use simple Lines 229 to 241 in 874f141
There might be a bug in rasterio when using https://github.com/rasterio/rasterio/blob/main/rasterio/_io.pyx#L680-L735 |
import rasterio
with rasterio.open("tests/fixtures/cog.tif") as src_dst:
arr = src_dst.read(
masked=True,
fill_value=-1,
window=((-100,200), (-100,200)),
boundless=True,
)
print(arr.data)
>> [[[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
...
[0 0 0 ... 1 1 1]
[0 0 0 ... 1 1 1]
[0 0 0 ... 1 1 1]]] I would expect the Interestingly the print(arr.mask)
>> [[[ True True True ... True True True]
[ True True True ... True True True]
[ True True True ... True True True]
...
[ True True True ... False False False]
[ True True True ... False False False]
[ True True True ... False False False]]] but we override it in Line 241 in 874f141
|
I'm not sure if this is a usage issue on my part or a bug, but I'm noticing that the
.tile()
method sometimes doesn't mask the output image when the tile extends beyond the extent of the source dataset.All looks good for tile
x=82
,y=198
,z=9
when not specifyingnodata
:But then when I specify
nodata
it seems the returned image is no longer masked outside the bounds:Originally posted in banesullivan/localtileserver#197
The text was updated successfully, but these errors were encountered: