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

Is it possible to combine the values from two rasters? I.e. raster math client side #73

Open
staffordsmith83 opened this issue Mar 1, 2023 · 4 comments

Comments

@staffordsmith83
Copy link

Is your feature request related to a problem? Please describe.
This feature request is not related to a problem.

Describe the solution you'd like
We would like to be able to perform things like image differencing client side - subtracting the pixel values of one raster from another, and displaying the results.

Describe alternatives you've considered
We have tried implementing the server side.

Additional context
We are also using georaster-layer-for-leaflet, and are very grateful for this awesome project.

@DanielJDufour
Copy link
Member

Hi, @staffordsmith83 . Thanks for your great question! If you are looking to do this for georaster-layer-for-leaflet, I'd recommend checking out this example: https://github.com/GeoTIFF/georaster-layer-for-leaflet-example/blob/master/examples/separated.html. GeoRasterLayer supports multiple georasters and does the band arithmetic on the fly, which means it is relatively fast, but also doesn't produce an output that one could download.

If you are looking to do this and produce a high-res output that operates on the true values (not overview values) and can be downloaded, you might have to combine the data in JavaScript into an "in-memory simple GeoRaster object" and then pass that to GeoBlaze's bandArithmetic function.

Coincidentally, the issue popped up on the GeoBlaze issues just the other day! GeoTIFF/geoblaze#195 (comment)

It's my middle term goal to add multi-raster support to geowarp or a new library that uses it, but unfortunately this cleaner solution is still a year or so away.

Let me know if you have any more questions!

@staffordsmith83
Copy link
Author

Hi @DanielJDufour thanks so much for your detailed reply and thanks again for your work!

@DanielJDufour
Copy link
Member

Hi, @staffordsmith83 . If the georasters are small (i.e. can read all values into memory), this notebook also shows how to merge/stack them into one georaster. I'd like to work on a better solution in the long term, but might take some time before that happens. (because I'm consider API changes for georaster for the next major version while trying not to break any pre-existing code).
https://observablehq.com/d/723dc08141af20d0

@staffordsmith83
Copy link
Author

Thanks for this Daniel, we dont really need to be able to download, and operating on the overviews should work best for us I think. Thanks for sharing the workbook having a look at that too. Thanks!

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

2 participants