Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,59 +1,20 @@
|
|
1 |
-
import
|
2 |
-
import
|
3 |
-
from
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
)
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
fillable = True,
|
22 |
-
)
|
23 |
-
|
24 |
-
|
25 |
-
def server(input, output, session):
|
26 |
-
|
27 |
-
@reactive.calc
|
28 |
-
@reactive.event(input.button)
|
29 |
-
def generate_map():
|
30 |
-
|
31 |
-
Map = geemap.Map(center=[40, -100], zoom=4)
|
32 |
-
|
33 |
-
landsat7 = (
|
34 |
-
ee.Image('LANDSAT/LE7_TOA_5YEAR/1999_2003')
|
35 |
-
.select(['B1', 'B2', 'B3', 'B4', 'B5', 'B7'])
|
36 |
-
)
|
37 |
-
|
38 |
-
landsat_vis = {'bands': ['B4', 'B3', 'B2'], 'gamma': 1.4}
|
39 |
-
|
40 |
-
Map.addLayer(landsat7, landsat_vis, "Landsat")
|
41 |
-
|
42 |
-
hyperion = ee.ImageCollection('EO1/HYPERION').filter(ee.Filter.date('2016-01-01', '2017-03-01'))
|
43 |
-
|
44 |
-
hyperion_vis = {
|
45 |
-
'min': 1000.0,
|
46 |
-
'max': 14000.0,
|
47 |
-
'gamma': 2.5,
|
48 |
-
}
|
49 |
-
Map.addLayer(hyperion, hyperion_vis, 'Hyperion')
|
50 |
-
|
51 |
-
return Map
|
52 |
-
|
53 |
-
@output
|
54 |
-
@render_widget
|
55 |
-
def result():
|
56 |
-
return generate_map()
|
57 |
-
|
58 |
-
|
59 |
-
app = App(app_ui, server)
|
|
|
1 |
+
from shiny import reactive
|
2 |
+
from shiny.express import input, ui
|
3 |
+
from shinywidgets import render_widget
|
4 |
+
import ipyleaflet as ipyl
|
5 |
+
|
6 |
+
city_centers = {
|
7 |
+
"London": (51.5074, 0.1278),
|
8 |
+
"Paris": (48.8566, 2.3522),
|
9 |
+
"New York": (40.7128, -74.0060)
|
10 |
+
}
|
11 |
+
|
12 |
+
ui.input_select("center", "Center", choices=list(city_centers.keys()))
|
13 |
+
|
14 |
+
@render_widget
|
15 |
+
def map():
|
16 |
+
return ipyl.Map(zoom=4)
|
17 |
+
|
18 |
+
@reactive.effect
|
19 |
+
def _():
|
20 |
+
map.widget.center = city_centers[input.center()]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|