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
fix for issue 647 #648
fix for issue 647 #648
Conversation
🥳 we already had tests to make sure we were fetching the right overview https://github.com/cogeotiff/rio-tiler/blob/main/tests/test_overview.py I've added some and they are ✅ so we should be good to go 🚢 |
asset3 = os.path.join(os.path.dirname(__file__), "fixtures", "mosaic_cog3.tif") | ||
asset1 = os.path.join(os.path.dirname(__file__), "fixtures", "mosaic_value_1.tif") | ||
asset2 = os.path.join(os.path.dirname(__file__), "fixtures", "mosaic_value_2.tif") | ||
asset3 = os.path.join(os.path.dirname(__file__), "fixtures", "mosaic_value_3.tif") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the assets to avoid resampling to have a role (because depending on GDAL versions the pixel values can slightly change)
src_dst, bounds, height, width, dst_crs=dst_crs | ||
src_dst, | ||
bounds, | ||
dst_crs=dst_crs, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now construct a VRT aligned with the reading
bounds but which has the size
defined by its projected resolution.
TODO
|
Awesome! Glad you got to the bottom of this @vincentsarago... not sure whether anyone else on earth would have had a chance 😅 |
@vincentsarago I pulled the newly released Before (rio-tiler 4.1.10, TiTiler 0.11.6) After (rio-tiler 6.2.4, TiTiler 0.15.1) Of course my test was not just testing changes from Do you think this change is responsible? |
😭 |
@DanSchoppe can you share how you created this? |
😬 I see them too 😓 This is happening when we are When you add Line 309 in 63f1a3f
|
I kinda think that's a better behaviour in general. what do you think? Feel free to add we could also switch to |
This would fetch an extra pixel on each edge (eg. 258x258 resolution) to eliminate edge effects, correct? Are there any resampling algorithms that operate on a kernel larger than this padding (for example, would benefit from 260x260)? Sure seems like default padding would be a great improvement, especially if 1px optimizes every resampling algorithm. Even when you're fetching just one tile, the padding would give you higher quality data near the edges. |
yes
I don't know
It will only improve for non-nearest.
Changing the default from This is something that could be set by default at titiler level 🤷 |
Even nearest might find that the padded pixel is actually nearer, right? So it'd benefit nearest as well.
Oh, I was thinking the suggested change was to fetch with padding, perform any required operations (eg. resampling), then return a non-padded tile. If the suggestion was to return 258x258 tiles by default, that seems like a non-starter 😅
That's fine for my personal needs, but leaving this tile edge artifact in rio-tiler seems pretty bad, doesn't it? |
no, no. You suggested to set padding to something different than 0. with the padding option the output tile will always be 256 (the pixels are removed automatically) I agree it might not be a big thing, but in some case having
the edges will be visible only in some case (mostly oversampling and for non-nearest resampling) so I feel rio-tiler is 👌 not setting default for the users. |
We can start a new issue and see if other people have opinions! 🙏 |
Sounds good!
🚀 Plus resampling is working again! 💯 Thanks @vincentsarago ! |
@DanSchoppe here is a small analysis of the impact of the resampling and padding https://gist.github.com/vincentsarago/ff73ea5dbf128949d951851cc8454b4f the TLDR, padding is useful mostly when overzooming. When in the dataset's zoom range there is not highly visible edges so padding do not have huge impact. |
This PR should closes #647
The main problem is that we are creating a WarpedVRT aligned with the desired bounds (to make sure we fetch the overview) but also with the
output
size, which result in theresampling_method
having no effect because there is not downscaling/upscaling happening atread
step.To ✅ the solution we will need to add
tests
proving the resampling effects but also still make sure that we are fetching the overviews!!!