-
Notifications
You must be signed in to change notification settings - Fork 11
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
Overview asset 2 #13
Overview asset 2 #13
Conversation
Not sure what's going on here, but you seem to really clean things up in addition to adding the overviews, right? Looks awesome! PS: Chris is about to make some noise about stac-layer tomorrow or so in a blog post, I think... |
Yup. Adding the overview support and sorta fixing the issue with georaster hanging by adding a timeout. Several more check-ins happening asap. |
@m-mohr , okay. this is ready for your review. Sorry for the delay. There's a few updates.
It might be worth splitting some of the functionality into their own micro packages like imageOverlay, tileLayer, and with-timeout as I could see that functionality being useful in other projects, but I'll let you make that determination. |
@m-mohr, also if you have time, could you check if this new code works well with stac-browser? I wouldn't want to accidentally break anything! I could also publish a release candidate to NPM if that makes it easier for you. |
Thanks a lot! I'll try to review and test this by the end of the week at the latest. |
I've tried to build stac-layer on Windows with Node 16.13.0, but can't get it to build.
While I could certainly enable this feature, I don't think it should be required to use stac-layer. I must admit I don't fully understand the line that is erroring ( |
I was able to run stac-layer in STAC Browser. Before it worked, see https://radiantearth.github.io/stac-browser/#/external/cbers-stac-1-0-0.s3.amazonaws.com/CBERS4/MUX/001/022/CBERS_4_MUX_20210819_001_022_L2.json I'm not 100% sure yet whether that's an issue on stac-layers side or whether that is due to some CORS issues (I'm testing on localhost instead of on github pages right now). Overall it seems you didn't break anything, I'd suspect the issue above is CORS. Maybe you can give it a quick try yourself. Lastly, it indeed does not show the previews anymore, which is good. I don't think I have a public example with an overview though. Thanks! |
@m-mohr , regarding the build issue on Windows. That was totally my fault. I left in some test code accidentally. I removed it and committed the fix you identified. Sorry again for that. |
I think there's two things going on with the CBERS data. The first is that, the previous version of stac-layer displayed assets with the key "thumbnail", the new version treats thumbnails as previews and hides them by default. That's why we see something with the old version and no imagery with the new. Regarding the other issue with the Network Error. I think this is because the assets are using the S3 protocol, like "s3://..." and so we can't fetch them in the browser. I'm not sure the best way to treat thumbnails. If you'd like them to be treated as overviews, we could definitely update the code to do that. |
Sorry, missed another issue, which is that in the new version no layer even loads. I'll look into that. |
Oh, indeed, that are thumbnails for CBERS. Sorry, that is my fault, did not realize that. So it should not display anything by default as thumbnails usually don't make a lot of sense on the map, but is also doesn't load the COGs once selected. That's due to s3, I guess? |
Yes, that's correct. But for some reason it appears an error is not being caught. I'm not sure if that's on the stac-layer or stac-browser side. |
The issue seems to be:
I need to check whether that is a STAC Browser issue, but will have to sleep first. ;-) |
@m-mohr , I think the issue is that stac-layer is compiled with a different instance of Leaflet than the one that stac-browser uses, so this line fails, which causes the whole adding to the map to throw an error. I'll try to help brainstorm solutions. One would be trying to directly Another solution would be to try to override the addTo function and somehow get the instance of Leaflet and the bounds constructor from the map object and then on-the-fly recreate the bounds object using the correct instance of Leaflet. (but I don't think this would work if the user typed But I have to admin I'm a bit perplexed and not sure I have correctly diagnosed the issue. I thought added Leaflet to the externals in the webpack.config.cjs would have fixed this problem. We could also try adding a new build that is just running babel without all the other webpack stuff. Therefore where a user imports stac-layer they are essentially importing it and running through their own compiler. We could still keep the webpack build for unpkg jsdelivr and other CDNs or people who are loading it through a script tag. But this would require a lot of testing as I'm not sure what different build tools look for with regards to keys in package.json (main vs. browser, etc.). This might be something we'd want to do anyway, because it could allow adopters/users to have smaller builds. Lastly, we could try to submit a PR to Leaflet to relax the super strict instanceof. Thoughts? |
Okay, that makes sense. I often face this issue when linking dev packages locally. Usually that is only a local issue and once stac-layer would be released it's working again. So from my side I think we can simply release after the open PRs have been merged. I expect this to work again and if it is not working, we can look into a fix again and release a patch version. |
Sounds good. |
PR to visualize updates to displayOverview work.
Some of the changes are actually from the main branch.