-
Notifications
You must be signed in to change notification settings - Fork 74
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
Use percentiles in /rgb bands stretch range #320
Comments
This is the correct solution. I can see how firing 3 requests for this may seem wasteful, but it's important to keep in mind that serving up tiles fires hundreds of requests within seconds. I'd rather not complicate the API by introducing additional parameters. I'm going to close this for now, I might be swayed in the future by additional evidence that this is a major pain point for people right now. |
|
Dear @dionhaefner and @j08lue, Calling 3x During fetching the tiles i can tolerate some delay, but generating these urls i'd prefer to be without 3rd party calls. Do you think it's a feature creep to extend the band/range functionality in this or any other ways? thanks in advance |
We did just add functionality to query metadata for many datasets in bulk. Would that help? |
Dear @j08lue thanks |
@j08lue I'm not sure I understand what you mean here? Terracotta has the percentiles pre-computed already in the metadata table, so the information is already coming from Terracotta, not the client. It's just that now the information has to be extracted from terracotta with 1 http call to /metadata, then passed back to terracotta in another http call to /rgb, which seems silly when the information is already there. It seems that you assume the percentiles would be computed dynamically, for just 1 tile? That's not the case. The dataset-wide percentiles are already computed and available in the database. |
Something like a 2%/98% stretch seems to be an obvious use-case for the metadata, so to me, it seems that it would be a simplification of the API to allow it to use this information rather than forcing the user to do several API calls. Terracotta is built around a database, a design choice with some downsides, but it also theoretically enables Terracotta to do a lot of cool stuff because it can actually know things about the datasets besides what is available in the file format. Taking advantage of the database to do things like this could be a way to set Terracotta apart from other tile servers like TiTiler. |
Ah, you are right, @mrpgraae, we already store the global stats in the db. 🤦 Sorry @atanas-balevsky I got that wrong. That makes percentile-based stretch ranges a lot more interesting as a feature, of course. You could think of pretty easy ways to encode that in the URL parameters, like
and maybe
for standard deviation. We could still keep it simple - no need to go custom script crazy like Sentinel Hub. 😉 But it would introduce a new internal dependency on the database and its contents, I guess. |
@j08lue Race-condition 😄 you posted same time as me, but
seems to go well with my last paragraph. |
Frankly that's all i'm hoping for :) sorry for not being clear enough that fetching the |
Is this:
really so much simpler than this:
that it requires dedicated syntax? |
Dear @dionhaefner
now is:
i hope you can see how this can make the /rgb endpoint more convenient to use. p.s. ll repeat if it got lost in the convo: i'd would propose a PR if you'd welcome this effort thanks |
Dear terracotta team,
Many thanks for the great product!
I've a small request: For the
/rgb
endpoint's range stretching, instead of using absolute values in the*_range
parameters, I'd like to use the band's percentiles.Right now i'm fitting this by calling the
/metadata
endpoint per band and fetching the percentiles, which later i add as the*_range
parameters.Instead of making 3 http calls to generate an url, would it be possible to add
*_percentiles
parameters to the/rgb
endpoint and calculate the range values internally?p.s. would love to submit a PR for this, if you welcome it
thanks in advance
The text was updated successfully, but these errors were encountered: