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

onSuccess event #37

Open
eelcocramer opened this issue Mar 11, 2022 · 7 comments
Open

onSuccess event #37

eelcocramer opened this issue Mar 11, 2022 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@eelcocramer
Copy link

It would be nice to have an event that would tell the caller that the image has successfully been processed. This would allow the UI to show a spinner while the image is being loaded / processed.

I can contribute on this if someone can give some pointers about where to add this.

@danwild danwild added enhancement New feature or request good first issue Good for newcomers labels Mar 11, 2022
@danwild
Copy link

danwild commented Mar 11, 2022

Hi @eelcocramer,

For initial load of data, you could use the sourceFunction option with something other than GeoTIFF.fromUrl (i.e. handle the async pre-load of data yourself).

For a true onSuccess event tho, the renderer itself would also need to provide a callback/event in order for us to know when it is done (so if you are using the plotty renderer, step 1 would be to check if it has something like this, or if one could be added).

@eelcocramer
Copy link
Author

eelcocramer commented Mar 12, 2022

Thanks for your response @danwild I appreciate it.

Before I opened this issue I tried loading the data myself in both a blob and arraybuffer but geotiff.js throws an error when processing that data: TypeError: Invalid byte order value.. The fromUrl method does not show this behaviour.

Actually I found that the rendering of data is quite fast. Loading seem to be the issue. The backend I'm hitting takes a couple of seconds to process a request. I notice though that fromUrl is hitting the backend 6 (!) times when I use it to load the image.

@eelcocramer
Copy link
Author

eelcocramer commented Mar 12, 2022

When I run the demo the tif's are only requested once so I assume something must be wrong on my (front- or back-) end.

@eelcocramer
Copy link
Author

eelcocramer commented Mar 12, 2022

Increasing the blockSize fixes the issue where the tiff is requested multiple times.

I can't get the fromArrayBuffer to work. This expression is always true. First I believed it was because I used geotiffjs version > 2 but when I downgraded to the version listed in this project this still happens.

edit: never mind I did not import geotiff.js correctly

@eelcocramer
Copy link
Author

For initial load of data, you could use the sourceFunction option with something other than GeoTIFF.fromUrl (i.e. handle the async pre-load of data yourself).

So this suggestion works fine actually. I don't really need an onSuccess on the rendering so as far as I'm concerned this issue may be closed.

Thanks for the help!

@muety
Copy link

muety commented Apr 4, 2022

I'd be happy to have an onSuccess function :)

Btw., is there a downside to setting blockSize arbitrarily high?

@crawld
Copy link

crawld commented May 8, 2022

GeoTIFF.fromUrl is useful for loading a subset of the data from a large tiff.

In #38 I added a loadTiff event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants