stac-browser icon indicating copy to clipboard operation
stac-browser copied to clipboard

buildTileUrlTemplate in config.js as an async function

Open randyberos opened this issue 2 years ago • 3 comments
trafficstars

We are using a Titiler server for rendering the COG image in the map. To have a better visual of the tiled image, we need to provide the rescale value of the COG image to the Titiler server. We are currently querying the percent_2 and percent_98 of the band statistics using the /cog/statistics of Titiler. Querying the statistics of the COG image requires the buildTileUrlTemplate to be asynchronous. This causes an error because stac-layer is not expecting an async buildTileUrlTemplate function. Below is the snippet of the error.

Is it possible for the buildTileUrlTemplate to expect an async function?

error:

[stac-layer] caught the following error while trying to add a tile layer: TypeError: str.replace is not a function

randyberos avatar Sep 28 '23 09:09 randyberos

Hi, @randyberos . Great suggestion. On first read, I think this should be possible. Would you be interested in submitting a PR to https://github.com/stac-utils/stac-layer ?

DanielJDufour avatar Sep 28 '23 12:09 DanielJDufour

This would also need to be implemented in ol-stac, which we'll migrate to.

Also important to note is that this may break existing configs and needs a big warning in the changelog!

m-mohr avatar Sep 28 '23 13:09 m-mohr

Hello @DanielJDufour. I created a pull request for this issue. Thanks.

randyberos avatar Sep 29 '23 04:09 randyberos

ol-stac supports this in the next version, this will be part of STAC Browser iun v3.4.0. Development version for testing: #535

m-mohr avatar Jan 29 '25 21:01 m-mohr