gee-community / geemap

A Python package for interactive geospatial analysis and visualization with Google Earth Engine.
https://geemap.org
MIT License
3.47k stars 1.09k forks source link

time_slider not in the Map when I exported as HTML #1552

Closed isaacarroyov closed 1 year ago

isaacarroyov commented 1 year ago

I'm creating a map with a slider in it. In the notebook, everything runs fine:

import ee
ee.Initialize()
import geemap
from ipyleaflet import basemaps

# . . .
# . . .

Mapa = geemap.Map(basemap = basemaps.CartoDB.DarkMatter)
Mapa.center_object(geom_mexico, 5)
Mapa.add_time_slider(img_coll_pdsi_tag_month_year, mapVisParamsPDSI,
                     layer_name = "Índice de Severidad de Sequía de Palmer",
                     labels = labels_dates,
                     position='topleft',
                     slider_length = "300px",
                     time_interval=1)
Screenshot 2023-06-02 at 19 19 54

However, when I exported the map:

Mapa.to_html("./../charts_html/Mapa_sequia_meses_1960-2022.html",
             title = "SequiaEnMexico",
             width = "100%", height = "400px")

The slider is not in the HTML file. Am I doing something wrong?

Screenshot 2023-06-02 at 19 17 53

Thanks in advance for the help ✨

giswqs commented 1 year ago

No, ipywidgets won't work when the map is exported as static HTML. You can use voila or solara to develop interactive web apps that support ipywidgets.