Steps to deploy an Earth Engine App:
voila --no-browser 28_voila.ipynb
ngrok http 8866
Optional steps:
voila --no-browser --strip_sources=False 28_voila.ipynb
ngrok http -auth="username:password" 8866
sudo python -m http.server 80
import os
import ee
import geemap
import ipywidgets as widgets
Map = geemap.Map()
Map
style = {'description_width': 'initial'}
title = widgets.Text(
description='Title:',
value='Landsat Timelapse',
width=200,
style=style
)
bands = widgets.Dropdown(
description='Select RGB Combo:',
options=['Red/Green/Blue', 'NIR/Red/Green', 'SWIR2/SWIR1/NIR', 'NIR/SWIR1/Red','SWIR2/NIR/Red',
'SWIR2/SWIR1/Red', 'SWIR1/NIR/Blue', 'NIR/SWIR1/Blue', 'SWIR2/NIR/Green', 'SWIR1/NIR/Red'],
value='NIR/Red/Green',
style=style
)
hbox1 = widgets.HBox([title, bands])
hbox1
start_year = widgets.IntSlider(description='Start Year:', value=1984, min=1984, max=2019, style=style)
end_year = widgets.IntSlider(description='End Year:', value=2019, min=1984, max=2019, style=style)
hbox2 = widgets.HBox([start_year, end_year])
hbox2
speed = widgets.IntSlider(
description='Frames per second:',
tooltip='Frames per second:',
value=10,
min=1,
max = 30,
style=style
)
upload = widgets.Checkbox(
value=False,
description='Upload to imgur.com',
style=style
)
hbox3 = widgets.HBox([speed, upload])
hbox3
font_size = widgets.IntSlider(description='Font size:', value=30, min=10, max=50, style=style)
font_color = widgets.ColorPicker(
concise=False,
description='Font color:',
value='white',
style=style
)
progress_bar_color = widgets.ColorPicker(
concise=False,
description='Progress bar color:',
value='blue',
style=style
)
hbox4 = widgets.HBox([font_size, font_color, progress_bar_color])
hbox4
submit = widgets.Button(
description='Submit',
button_style='primary',
tooltip='Click the submit the request to create timelapse',
style=style
)
output = widgets.Output()
def submit_clicked(b):
with output:
output.clear_output()
if start_year.value >= end_year.value:
print('The end year must be great than the start year.')
return
print('Computing...')
Map.add_landsat_ts_gif(roi=Map.user_roi, label=title.value, start_year=start_year.value,
end_year=end_year.value, start_date='05-01', end_date='10-31',
bands=bands.value.split('/'), font_color=font_color.value,
frames_per_second=speed.value, font_size=font_size.value,
progress_bar_color=progress_bar_color.value, upload=upload.value)
submit.on_click(submit_clicked)
submit
output