Layer loading spinner proof-of-concept
giswqs opened this issue · 0 comments
giswqs commented
This is a proof-of-concept of the layer loading spinner. It works in JupyterLab, but does not work VS Code. Bug reported on the ipywdiget repo. jupyter-widgets/ipywidgets#3909
import ee
import geemap
import ipywidgets as widgets
m = geemap.Map()
image = ee.Image('USGS/SRTMGL1_003')
vis = {'min': 0, 'max': 4000, 'palette': 'terrain'}
layer = geemap.ee_tile_layer(image, vis, 'SRTM DEM')
m.add_layer(layer)
spinner = widgets.Button(description='Loading ...', icon='spinner spin lg')
m.add_widget(spinner, position='topright')
def loading_change(change):
if change['new']:
spinner.description = "Loading ..."
spinner.icon = "spinner spin lg"
else:
spinner.description = "Loaded"
spinner.icon = "check"
layer.observe(loading_change, 'loading')
m