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
Provide parameter for retrieving additional data around tile edges to minimise edge effects #104
Conversation
thanks @rowanwins this is great. I need to think about how to check if the tile is aligned then also check the performances (which should not vary). |
@rowanwins maybe we can do something like def is_aligned(src_dst, bounds, tilesize):
"""Check if tile is aligned with internal tiles."""
if src_dst.crs != CRS.from_epsg(3857):
return False
col_off, row_off, w, h = windows.from_bounds(
*bounds, height=tilesize, transform=src_dst.transform, width=tilesize
).flatten()
if round(w) % 64 and round(h) % 64:
return False
if (src_dst.width - round(col_off)) % 64:
return False
if (src_dst.height - round(row_off)) % 64:
return False
return True The idea is to check:
why 64px ?ideally we want to check if the window is a multiple of the internal tile size (raw data and overview) but we don't have a way to do it with rasterio and I'm not sure this is needed. By checking if we have a multiple of 64 we make sure that even on border tiles we don't need to do resampling. Note: this might be totally wrong, but did a quick check with a web-optimized file and it work |
…ad. Clarify param in docstring. Provide better default window.
I've made those changes. |
@rowanwins you can use this file https://www.dropbox.com/s/op0szbw18szqupc/web.tif?dl=0 |
@rowanwins The PR looks excellent (I like the tests you added).
Thanks |
I attempted to change the base but I'm not sure if that worked TBH (I ran I think everything else is ticked off other than codecov complaining about a decrease in coverage. It would be good to test that |
this is great @rowanwins I'll take it from here. thanks for your help |
Out of interest how did you change the base branch @vincentsarago ? |
@rowanwins In fact I had the option in the Github UI 😬 (I didn't know I could do that before) |
As proposed in #56 this PR aims to reduce the edge effects associated with tiles by introducing a
tile_edges_padding
parameter. Additional data is retrieved around the tiles edges during the tile generation process which helps to reduce sharp edges that occur due to resampling.@vincentsarago did suggest
I'm not really sure how we'd know about the internal tiles so happy to take any advice on this one :)
Let me know if you need anything else on this.