cboettig commited on
Commit
5d54e07
·
1 Parent(s): f052b1c

custom raster

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -28,6 +28,8 @@ public_color = "#3388ff" # blue
28
  low = 2
29
  high = 3
30
  alpha = .5
 
 
31
 
32
  # +
33
  st.set_page_config(layout="wide", page_title="Protected Areas Explorer", page_icon=":globe:")
@@ -174,9 +176,10 @@ def pad_style(paint, alpha):
174
  }
175
  }]}
176
 
177
- manager_colors = {"bucket": ["public", "tribal", "mixed", "private"],
178
- "color": [public_color, tribal_color, mixed_color, private_color]}
179
-
 
180
  # +
181
  ## Map controls sidebar
182
 
@@ -241,6 +244,13 @@ with st.sidebar:
241
  hi="https://data.source.coop/vizzuality/hfp-100/hfp_2021_100m_v1-2_cog.tif"
242
  m.add_cog_layer(hi, palette="purples", name="Human Impact", transparent_bg=True, opacity = 0.8, zoom_to_layer=False)
243
 
 
 
 
 
 
 
 
244
  # "## Boundaries"
245
  # boundaries = st.radio("Boundaries:",
246
  # ["None",
 
28
  low = 2
29
  high = 3
30
  alpha = .5
31
+ style_choice = "Manager Type"
32
+
33
 
34
  # +
35
  st.set_page_config(layout="wide", page_title="Protected Areas Explorer", page_icon=":globe:")
 
176
  }
177
  }]}
178
 
179
+ code_ex='''
180
+ m.add_cog_layer("https://data.source.coop/vizzuality/lg-land-carbon-data/natcrop_expansion_100m_cog.tif",
181
+ palette="oranges", name="Cropland Expansion", transparent_bg=True, opacity = 0.7, zoom_to_layer=False)
182
+ '''
183
  # +
184
  ## Map controls sidebar
185
 
 
244
  hi="https://data.source.coop/vizzuality/hfp-100/hfp_2021_100m_v1-2_cog.tif"
245
  m.add_cog_layer(hi, palette="purples", name="Human Impact", transparent_bg=True, opacity = 0.8, zoom_to_layer=False)
246
 
247
+ if st.toggle("Custom map layers"):
248
+
249
+ code = st.text_area(label = "leafmap code:",
250
+ value = code_ex,
251
+ height = 100)
252
+ eval(compile(code, "<string>", "exec"))
253
+
254
  # "## Boundaries"
255
  # boundaries = st.radio("Boundaries:",
256
  # ["None",