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

More problems with ipyleaflet plots in docs #12

Open
eeholmes opened this issue Apr 5, 2022 · 2 comments
Open

More problems with ipyleaflet plots in docs #12

eeholmes opened this issue Apr 5, 2022 · 2 comments

Comments

@eeholmes
Copy link
Member

eeholmes commented Apr 5, 2022

In order to render a notebook with an ipyleaflet plot into markdown, the widget state needs to be saved which can be done from within JupyterLab or classic notebooks. This so far has worked for the plots. But now the geemap plots in
https://icesat-2hackweek.github.io/coastal_topobathy/examples/AK_topobathy_vis.html
don't fully save the widget state. The polygons in the plots at the bottom don't show up. Nothing I have tried has successfully saved the widget state for these plots.

  • Alternate, and preferred, method would be to save these ipyleaflet plots to png so they can be displayed in the examples. This would also mean that we don't have to save the widget state and files would be smaller.

But I have yet to find a way that one can export an ipyleaflet plot to png. Essentially do a "screenshot" and save that. On stackoverflow, the recommendation is to do just that: manually take a screenshot!

  • Another idea is just to avoid ipyleaflet altogether but the tutorials lean heavily on that so that would require a lot of work to switch to matplotlib (or similar)
@eeholmes
Copy link
Member Author

eeholmes commented Apr 5, 2022

I give up. I have tried the following with no success.

  • Take a screenshot with geemap.to_image() https://geemap.org/geemap/#geemap.geemap.Map.to_image Seems designed to take a screenshot of a monitor
  • Save to html. Tried using geemap tools and ipyleaflet embed_html tool. Created html with lots of stuff in it but could not display the html in a browser.
  • Tried saving a png from within the widget using the camera tool. Nope. It shows a Display not set warning. I could not find any info online for how to set the display for the geemap ipyleaflet widgets.
  • Tried recreating plot with new code rather than Map.addLayer. Nope all widgets except the first have missing layers.

@eeholmes
Copy link
Member Author

eeholmes commented Apr 5, 2022

Problem seems to be with the widget saving after the first widget. So first plot is ok, but subsequent ones won't have layers.

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

1 participant