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

Better handle Dateline crossing Dataset #702

Open
vincentsarago opened this issue May 3, 2024 · 0 comments
Open

Better handle Dateline crossing Dataset #702

vincentsarago opened this issue May 3, 2024 · 0 comments

Comments

@vincentsarago
Copy link
Member

Min/Max Zoom

from rio_tiler.io import Reader

with Reader("tests/fixtures/cog_dateline.tif") as src:
    print(src.minzoom, src.maxzoom)

4 4

but it should be 7 -> 11

The issue is that rasterio's calculate_default_transform doesn't seems to handle well the dateline crossing dataset.

Potential fix in https://github.com/cogeotiff/rio-tiler/blob/main/rio_tiler/io/rasterio.py#L147-L153

vrt_options = {"add_alpha": True}
if self.dataset.nodata is not None:
    vrt_options.update(
        {
            "nodata": self.dataset.nodata,
            "add_alpha": False,
            "src_nodata": self.dataset.nodata,
        }
    )

if has_alpha_band(self.dataset):
    vrt_options.update({"add_alpha": False})

with WarpedVRT(self.dataset, **vrt_options) as vrt:
    dst_affine = list(vrt.transform)
    w = vrt.width
    h = vrt.height

Dst Transform

same as ☝️ in https://github.com/cogeotiff/rio-tiler/blob/main/rio_tiler/utils.py#L354-L356

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

No branches or pull requests

1 participant