Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

mosaicing arbitary bounding boxes #10

Open
spolloni opened this issue Oct 25, 2019 · 2 comments
Open

mosaicing arbitary bounding boxes #10

spolloni opened this issue Oct 25, 2019 · 2 comments

Comments

@spolloni
Copy link

Salut Vincent!

thanks for the wonderful suite of tools you're building here. I am looking for utils or code snippets in either rio-tiler-mosaic or rio-tiler that would help build an equivalent of the mosaic_tiler function, but accepting an arbitrary bbox rather than a (x,y,z) tuple. Any pointers?

Also, would such a function be a meaningful contribution to this repo? would be happy to take a stab at a PR if that interests you.

@vincentsarago
Copy link
Member

Hi @spolloni,
This is totally possible.
in

_tiler = partial(tiler, tile_x=tile_x, tile_y=tile_y, tile_z=tile_z, **kwargs)

we pass x,y,z because mosaic_tiler expects the user to provide rio_tiler.{module}.tile function:

tiler: function
Rio-tiler's tiler function (e.g rio_tiler.landsat8.tile)

But this could be replaced by rio_tiler.utils.tile_read function https://github.com/cogeotiff/rio-tiler/blob/master/rio_tiler/utils.py#L439 which accepts bounds instead of XYZ info

I could totally add another function called mosaic_tiler_bounds.

The idea of using .tile method from rio-tiler submodule was to let rio-tiler handle errors for tile outside bounds and also make rio-tiler-mosaic as simple as possible

@spolloni
Copy link
Author

spolloni commented Oct 30, 2019

Thanks for the reply @vincentsarago !

The idea of using .tile method from rio-tiler submodule was to let rio-tiler handle errors for tile outside bounds and also make rio-tiler-mosaic as simple as possible

that makes a lot of sense, and in general I think that adhering to the XYZ model is great for keeping rio-tiler-mosaic's API simple and convenient. With that said, given the raster data is ultimately retrieved using rasterio windowed reads, I think there is a case for exposing that in the API as well.

I think a function such as mosaic_tiler_bounds would be a great addition, since it would avoid having to request all intersecting XYZ tiles (and then "stitching" them) when needing an arbitrary bbox from multiple COGs.

Let me know if I can assist somehow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants