-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add raster-stretch min-max paint properties #8587
Conversation
Hello, The intention in this PR is to mirror a certain layer color enhancement functionality that we have in QGis called More details about this |
The |
Sometimes its necessary to have the fragment pixel values stretched between a min and a max. These two new parameters achieve it. Leaving them as default will end up not changing anything.
hi @shobhitg thanks for putting this together. The For single band raster with #3889 you'd be able to do stretching by setting a higher minimum and a lower maximum stop. While I think this is a nice feature to support, and I certainly don't want to be too discouraging, but I do have concerns about how this would work when #3889 is implemented. Having both a raster-stretch when we implement raster colorize, I think raster-stretch would be redundant and cause unnecessary complexity, if anyone was using both at the same time. In that case I think it would be better to rely on raster-colorize to do stretching instead of raster-stetch. What do you think? |
Is there a sample implementation that goes with #3889 ? I feel |
No, but someone posted a checklist #3889 (comment)
I think they conflict with each other since the results vary based on which is applied first, to which there is no natural answer. For example if you have a single band raster with values from 0-255 then you can scale it as so but if you've also set a scale then does that happen before or after the above? And what does it achieve that raster-colorizer doesn't?
There is already a property to alter the brightness, raster-brightness-min and max, https://docs.mapbox.com/mapbox-gl-js/style-spec/#paint-raster-raster-brightness-min, how is this scale-min/max different? |
I don't entirely understand how
I should have given examples earlier. Doing so now. This is the original raster tile I am dealing with: This tile looks very dull, I wish to increase the comfort of looking into it by brightening it up. To brighten up, decreasing Playing with *Now compare this with if I decrease Day and night difference. The above example shows that |
It would be equivalent to QGIS's Singleband pseudocolor. Ie. you set data values which map to colours. You could set your own min/max for a singleband raster by setting the lower and upper ramp step values. here is the histogram of my example, you can see in blue how you could use rasterize to shift the ends of the range, so setting a new min/max. Thanks for examples on the difference with brightness. I think you could probably do the same by setting the right color stops to shift the histogram. It's mostly just that I see your proposal here conflicting with raster-colorize. Happy to be proven wrong. |
Thanks, I will try to experiment with |
I verify that the same desired effect can be achieved with Now only if we had a |
@shobhitg Thanks for this contribution and for using mapbox-gl-js!
I agree with @andrewharvey here. |
I will give it a shot next month. |
@shobhitg, given #8587 (comment), I'm going to close this PR for now. When you're ready to work on |
Sometimes its necessary to have the fragment pixel values stretched between a min and a max.
These two new parameters achieve it. Leaving them as default will end up not changing anything.
Launch Checklist
@mapbox/studio
and/or@mapbox/maps-design
if this PR includes style spec changes@mapbox/gl-native
if this PR includes shader changes or needs a native port