-
Notifications
You must be signed in to change notification settings - Fork 362
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
Render map and widgets in HTML web page #592
Comments
As far as I know, customized ipywidgets are not supported in the exported HTML. It would be nice if it can be supported in the future. The geemap package built upon ipyleaflet can also export HTML with a GUI. Again, customized ipywidgets are not supported as this moment. |
This is a bug, it should work. |
This will never be fixed though. The custom |
I'm trying to save a map with a GeoJSON layer on it as HTML. I can see the GeoJSON inside the saved HTML, but when I open the HTML in a browser I see only the basemap but no GeoJSON. Should this work? I've tried other MIME type for the GeoJSON inside the HTML, but in vain. See code below. import requests
from ipyleaflet import Map, GeoJSON
url = "https://raw.githubusercontent.com/johan/world.geo.json/master/countries.geo.json"
m = Map(zoom=1)
m += GeoJSON(data=requests.get(url).json())
m.save('my_map.html', title='My Map') |
@deeplook yes this should work. This looks like a bug. It might be related to the issue with the controls. |
Just came across this while trying to save the map example with linked ipywidgets https://ipyleaflet.readthedocs.io/en/latest/api_reference/widget_control.html
from ipyleaflet import Map, basemaps, WidgetControl
from ipywidgets import IntSlider, jslink
m = Map(center=(46.01, 6.16), zoom=12, basemap=basemaps.Stamen.Terrain)
zoom_slider = IntSlider(description='Zoom level:', min=0, max=15, value=7)
jslink((zoom_slider, 'value'), (m, 'zoom'))
widget_control1 = WidgetControl(widget=zoom_slider, position='topright')
m.add_control(widget_control1)
# Two approaches to saving
# 1) no visible slider
#m.save('ipyleaflet_widgets.html', title='Widgets export')
# 2) functioning linked slider, but under map instead of in topright
from ipywidgets.embed import embed_minimal_html
embed_minimal_html('ipyleaflet_widgets1.html', views=[m,zoom_slider], title='Widgets export') cc @davidbrochart in case you're aware of other workarounds? |
Hi!
I'm new to ipyleaflet and it's really a great tool!!
I have a map similar to the WealthOfNations map. I'd like to export the map and the controls and embed in an HTML page.
Following the suggestions from this issue I've saved the map, but this not includes the controls.
I've also obtained HTML using the "Embed widgets" option in the notebook. This produces the map and the widgets, but not the behavior (it doesn't refresh the graphics according to on_hover).
Any suggestions?
thanks in advance!
Lorena
The text was updated successfully, but these errors were encountered: