Skip to content
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 functions in styles. #960

Merged
merged 2 commits into from
Sep 13, 2022
Merged

Use functions in styles. #960

merged 2 commits into from
Sep 13, 2022

Conversation

manthey
Copy link
Member

@manthey manthey commented Sep 12, 2022

Resolves #688.

This can be used, for instance, to get a mask from a superpixel image. For instance, suppose you want a mask for the superpixel with an index of 82, you'd use a style like:
{"function":{"name":"large_image.tilesource.stylefuncs.maskPixelValues","context":true,"parameters":{"values":[82]}},"bands":[]} (or, if you are using superpixels with boundaries, this would be {"function":{"name":"large_image.tilesource.stylefuncs.maskPixelValues","context":true,"parameters":{"values":[164,165]}},"bands":[]}). The resulting image (assuming you are returning a PNG), will be opaque black where this value is not present and transparent white where it is (or specify the negative and positive parameters to get different colors).

@naglepuff This should be useful in showing just the superpixels from an image.

Resolves #688.

This can be used, for instance, to get a mask from a superpixel image.
For instance, suppose you want a mask for the superpixel with an index
of 82, you'd use a style like:
{"function":{"name":"large_image.tilesource.utilities.maskPixelValues","context":true,"parameters":{"values":[82]}},"bands":[]}
(or, if you are using superpixels with boundaries, this would be
{"function":{"name":"large_image.tilesource.utilities.maskPixelValues","context":true,"parameters":{"values":[164,165]}},"bands":[]}).
The resulting image (assuming you are returning a PNG), will be opaque
black where this value is not present and transparent white where it is
(or specify the negative and positive parameters to get different
colors).
@banesullivan
Copy link
Contributor

We should definitely add some examples, like for hillshade as I outlined in #688 (comment)

@banesullivan
Copy link
Contributor

I think hillshade is common enough that having a defined function in large-image is warranted

@manthey
Copy link
Member Author

manthey commented Sep 12, 2022

We should definitely add some examples, like for hillshade as I outlined in #688 (comment)

Definitely. I'm torn between adding these to tilesource.utilities and making a new module tilesource.stylefuncs. We can add that in a follow-up PR.

@banesullivan
Copy link
Contributor

+1 for a new module

@manthey manthey merged commit 471185e into master Sep 13, 2022
@manthey manthey deleted the style-functions branch September 13, 2022 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Band math when for getTile and getRegion
2 participants