Add NAIP imagery
Browse files- pages/03_timelapse.py +0 -4
- pages/04_timeseries.py +0 -3
- pages/05_jrc.py +0 -1
- pages/06_compare.py +0 -2
- pages/07_naip.py +102 -0
pages/03_timelapse.py
CHANGED
@@ -1,8 +1,4 @@
|
|
1 |
-
import os
|
2 |
-
import ee
|
3 |
import geemap
|
4 |
-
import ipywidgets as widgets
|
5 |
-
from IPython.display import display
|
6 |
import solara
|
7 |
|
8 |
|
|
|
|
|
|
|
1 |
import geemap
|
|
|
|
|
2 |
import solara
|
3 |
|
4 |
|
pages/04_timeseries.py
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
-
import os
|
2 |
-
import ee
|
3 |
import geemap
|
4 |
import ipywidgets as widgets
|
5 |
-
from IPython.display import display
|
6 |
import solara
|
7 |
from geemap import get_current_year, jslink_slider_label
|
8 |
|
|
|
|
|
|
|
1 |
import geemap
|
2 |
import ipywidgets as widgets
|
|
|
3 |
import solara
|
4 |
from geemap import get_current_year, jslink_slider_label
|
5 |
|
pages/05_jrc.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
import os
|
2 |
import ee
|
3 |
import geemap
|
4 |
import ipywidgets as widgets
|
|
|
|
|
1 |
import ee
|
2 |
import geemap
|
3 |
import ipywidgets as widgets
|
pages/06_compare.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
-
import os
|
2 |
import ee
|
3 |
import geemap
|
4 |
import ipywidgets as widgets
|
5 |
-
from IPython.display import display
|
6 |
import solara
|
7 |
from datetime import date
|
8 |
|
|
|
|
|
1 |
import ee
|
2 |
import geemap
|
3 |
import ipywidgets as widgets
|
|
|
4 |
import solara
|
5 |
from datetime import date
|
6 |
|
pages/07_naip.py
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import geemap
|
2 |
+
import solara
|
3 |
+
import ipywidgets as widgets
|
4 |
+
|
5 |
+
|
6 |
+
class Map(geemap.Map):
|
7 |
+
def __init__(self, **kwargs):
|
8 |
+
super().__init__(**kwargs)
|
9 |
+
self.add_basemap("Esri.WorldImagery", False)
|
10 |
+
self._toolbar.toggle_layers(False)
|
11 |
+
self.add_gui()
|
12 |
+
|
13 |
+
def add_gui(self):
|
14 |
+
widget_width = "350px"
|
15 |
+
padding = "0px 0px 0px 5px" # upper, right, bottom, left
|
16 |
+
style = {"description_width": "initial"}
|
17 |
+
button_width = "113px"
|
18 |
+
|
19 |
+
text = widgets.Text(
|
20 |
+
"Draw a rectangle on the map",
|
21 |
+
layout=widgets.Layout(padding="0px", width="230px"),
|
22 |
+
)
|
23 |
+
|
24 |
+
bands = widgets.Dropdown(
|
25 |
+
description="Bands:",
|
26 |
+
options=[
|
27 |
+
"Red/Green/Blue",
|
28 |
+
"NIR/Red/Green",
|
29 |
+
],
|
30 |
+
value="NIR/Red/Green",
|
31 |
+
layout=widgets.Layout(width="230px", padding=padding),
|
32 |
+
style=style,
|
33 |
+
)
|
34 |
+
|
35 |
+
apply_btn = widgets.Button(
|
36 |
+
description="Time slider",
|
37 |
+
button_style="primary",
|
38 |
+
tooltip="Click to create timeseries",
|
39 |
+
style=style,
|
40 |
+
layout=widgets.Layout(padding="0px", width=button_width),
|
41 |
+
)
|
42 |
+
|
43 |
+
split_btn = widgets.Button(
|
44 |
+
description="Split map",
|
45 |
+
button_style="primary",
|
46 |
+
tooltip="Click to create timeseries",
|
47 |
+
style=style,
|
48 |
+
layout=widgets.Layout(padding="0px", width=button_width),
|
49 |
+
)
|
50 |
+
widget = widgets.VBox([text, bands, widgets.HBox([apply_btn, split_btn])])
|
51 |
+
self.add_widget(widget, position="topright")
|
52 |
+
|
53 |
+
def apply_btn_click(b):
|
54 |
+
if self.user_roi is not None:
|
55 |
+
|
56 |
+
if bands.value == "NIR/Red/Green":
|
57 |
+
RGBN = True
|
58 |
+
vis_params = {"bands": ["N", "R", "G"], "min": 0, "max": 255}
|
59 |
+
else:
|
60 |
+
RGBN = False
|
61 |
+
vis_params = {"bands": ["R", "G", "B"], "min": 0, "max": 255}
|
62 |
+
collection = geemap.naip_timeseries(self.user_roi, RGBN=RGBN)
|
63 |
+
if hasattr(self, "slider_ctrl") and self.slider_ctrl is not None:
|
64 |
+
self.remove(self.slider_ctrl)
|
65 |
+
delattr(self, "slider_ctrl")
|
66 |
+
self.add_time_slider(
|
67 |
+
collection, vis_params=vis_params, date_format="YYYY"
|
68 |
+
)
|
69 |
+
|
70 |
+
apply_btn.on_click(apply_btn_click)
|
71 |
+
|
72 |
+
def split_btn_click(b):
|
73 |
+
if self.user_roi is not None:
|
74 |
+
if bands.value == "NIR/Red/Green":
|
75 |
+
RGBN = True
|
76 |
+
vis_params = {"bands": ["N", "R", "G"], "min": 0, "max": 255}
|
77 |
+
else:
|
78 |
+
RGBN = False
|
79 |
+
vis_params = {"bands": ["R", "G", "B"], "min": 0, "max": 255}
|
80 |
+
collection = geemap.naip_timeseries(self.user_roi, RGBN=RGBN)
|
81 |
+
|
82 |
+
self.ts_inspector(
|
83 |
+
collection,
|
84 |
+
left_vis=vis_params,
|
85 |
+
width="100px",
|
86 |
+
date_format="YYYY",
|
87 |
+
add_close_button=True,
|
88 |
+
)
|
89 |
+
|
90 |
+
split_btn.on_click(split_btn_click)
|
91 |
+
|
92 |
+
|
93 |
+
@solara.component
|
94 |
+
def Page():
|
95 |
+
with solara.Column(style={"min-width": "500px"}):
|
96 |
+
Map.element(
|
97 |
+
center=[40, -100],
|
98 |
+
zoom=4,
|
99 |
+
height="750px",
|
100 |
+
zoom_ctrl=False,
|
101 |
+
measure_ctrl=False,
|
102 |
+
)
|