Skip to content
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

refactor SpatialMixin.tile_exists to avoid coordinates overflow #455

Merged
merged 2 commits into from
Nov 10, 2021

Conversation

vincentsarago
Copy link
Member

Yet another of the tile_exists method.

When converting bounds from the dataset's CRS to the TMS's CRS it could result in coordinates overflow (a dataset can have bounds bigger than the TMS's CRS bounds). It's safer to apply the opposite: converting the tile_bounds from the TMS's CRS to the dataset's CRS.

COG_EARTH, tms=morecantile.tms.get("EuropeanETRS89_LAEAQuad")
) as cog:
img = cog.tile(0, 0, 1, tilesize=64)
assert img.data.shape == (1, 64, 64)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would have failed with the previous code

rio_tiler/io/base.py Outdated Show resolved Hide resolved
@vincentsarago vincentsarago merged commit 50b879d into master Nov 10, 2021
@vincentsarago vincentsarago deleted the tileExistV3 branch November 10, 2021 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant