Giter Site home page Giter Site logo

Comments (2)

vincentsarago avatar vincentsarago commented on May 21, 2024

I propose adding a response header like X-ASSETS that returns a comma-separated or JSON-encoded list of asset ids that were used to create the response tile. For many sources, the asset id includes enough information to extract a date range and other helpful metadata.

with the new cogeo-mosaic BaseBackend method this might be a bit tricky. Especially if we want list of asset ids that were used to create the response tile. An easy solution would be for tile to return the whole list of assets passed to the tiler but this won't mean that they were used.

ref: https://github.com/developmentseed/cogeo-mosaic/blob/c989249ecda0ab090e5fff86e6aba2ba8c882f3f/cogeo_mosaic/backends/base.py#L59-L72

    def tile(
        self, x: int, y: int, z: int, **kwargs: Any,
    ) -> Tuple[numpy.ndarray, numpy.ndarray]:
        """Get Tile from multiple observation."""

        assets = self.assets_for_tile(x, y, z)
        if not assets:
            raise NoAssetFoundError(f"No assets found for tile {z}-{x}-{y}")

        def _reader(asset: str, x: int, y: int, z: int, **kwargs: Any):
            with self.reader(asset) as src_dst:
                return src_dst.tile(x, y, z, **kwargs)

        return mosaic_reader(assets, _reader, x, y, z, **kwargs)

so in ☝️ do return mosaic_reader(assets, _reader, x, y, z, **kwargs), assets

we could also try to change mosaic_reader and https://github.com/cogeotiff/rio-tiler/blob/master/rio_tiler/mosaic/reader.py#L19-L52 but not sure it will work.

from titiler.

kylebarron avatar kylebarron commented on May 21, 2024

An easy solution would be for tile to return the whole list of assets passed to the tiler but this won't mean that they were used

That's actually what I expected, but maybe it's worth considering trying to return only what was used

from titiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.