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

Nearest-neighbor image resampling for ImageryLayer #5846

Closed
forman opened this issue Sep 27, 2017 · 9 comments
Closed

Nearest-neighbor image resampling for ImageryLayer #5846

forman opened this issue Sep 27, 2017 · 9 comments

Comments

@forman
Copy link
Contributor

forman commented Sep 27, 2017

We develop an application that uses Cesium to display climate data imagery. Many users (usually Earth scientists) would like to see the original grid cell extends in the images. Cesium seems to use (linearily) interpolated textures by default. Is there any possibility to set an ImageryLayer to a nearest-neighbor image resampling so actual grid cells would be displayed as squares? Even a global Cesium (or WebGL) setting would help.

To get an idea, here is a screenshot of the application showing monthly cloud averages in 0.5 degree grid cells. The interpolation applied makes it impossible to distinguish the original grid cells:

image

@ggetz
Copy link
Contributor

ggetz commented Sep 27, 2017

Hi there @forman. Please ask your question over at the Cesium Forum. Cesium's a big project, so we use GitHub for feature requests and bug tracking exclusively. Thanks!

@ggetz
Copy link
Contributor

ggetz commented Sep 27, 2017

@lilleyse confirmed that there's not a way to do this is Cesium currently. The imagery layer has the linear interpolation hard-coded, so we'll leave this open.

@mramato
Copy link
Contributor

mramato commented Sep 27, 2017

I think we had a thread about this at one point on the forum and it's come up before. @bagnell isn't modifying this just a one line change? Might be a good workaround or easy enough for someone to open a PR to handle.

@forman
Copy link
Contributor Author

forman commented Sep 27, 2017

Hi @ggetz, sorry for spaming your issue tracker and thanks for the info! Maybe @lilleyse could point me to the code location so we may fork & fix.

@forman
Copy link
Contributor Author

forman commented Sep 27, 2017

@mramato we're happy to do so

@bagnell
Copy link
Contributor

bagnell commented Sep 27, 2017

You can add Samplers to the textures here:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/ImageryLayer.js#L743

Set the minification and magnification filters to NEAREST. If the textures need reprojection, you can modify the samplers here:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/ImageryLayer.js#L796

@mramato
Copy link
Contributor

mramato commented Sep 27, 2017

Thanks @bagnell! Looking forward to a pull request @forman! Let us know if you run into any roadblocks.

@forman
Copy link
Contributor Author

forman commented Sep 28, 2017

@bagnell thanks, I hope to find some time next week for a PR.

Yeeha:
image

@forman
Copy link
Contributor Author

forman commented Dec 12, 2017

Closing this as the feature is already included since v1.39, 2017-11-01.

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

No branches or pull requests

4 participants