cboettig commited on
Commit
d221846
·
unverified ·
1 Parent(s): 918728f
Files changed (1) hide show
  1. app.py +13 -24
app.py CHANGED
@@ -51,11 +51,17 @@ Alternative color rules can be applied, for instance, to distinguish between eas
51
  charts summarize the total protected area and mean richness and mean RSR within each group.
52
 
53
  '''
54
- # -
55
 
 
 
56
 
 
 
 
 
 
 
57
 
58
- # +
59
  with st.sidebar:
60
 
61
  "## Map controls"
@@ -84,23 +90,10 @@ with st.sidebar:
84
 
85
 
86
  "### Custom styles"
87
- custom = st.text_area("Define a custom mapbox fill-color rule",
88
- value = '''{
89
- "fill-color":
90
- ['case',
91
- ['==', ['get', 'bucket'], 'public'],
92
- public_color,
93
- ['==', ['get', 'bucket'], 'private'],
94
- private_color,
95
- ['==', ['get', 'bucket'], 'tribal'],
96
- tribal_color,
97
- mixed_color # default (bucket == mixed)
98
- ],
99
- "fill-opacity": 0.5
100
- }
101
- ''',
102
- height = 300
103
- )
104
 
105
 
106
 
@@ -190,7 +183,7 @@ if style_choice == "species richness (thresholds)":
190
  if style_choice == "species richness (continuous)":
191
  paint_fill = richness
192
  if style_choice == "custom":
193
- paint_fill = custom
194
 
195
 
196
  r = {
@@ -375,7 +368,3 @@ The repository also includes static tiles from zooms 1-10 that can be used as a
375
  Technical details on processing are described in the repository.
376
 
377
  '''
378
-
379
-
380
-
381
-
 
51
  charts summarize the total protected area and mean richness and mean RSR within each group.
52
 
53
  '''
 
54
 
55
+ # +
56
+ ## Map controls sidebar
57
 
58
+ sample_style = '''
59
+ {
60
+ "fill-color": "blue",
61
+ "fill-opacity": 0.5
62
+ }
63
+ '''
64
 
 
65
  with st.sidebar:
66
 
67
  "## Map controls"
 
90
 
91
 
92
  "### Custom styles"
93
+ custom = st.text_area(
94
+ label = "Define a custom mapbox fill-color rule",
95
+ value = sample_style,
96
+ height = 100)
 
 
 
 
 
 
 
 
 
 
 
 
 
97
 
98
 
99
 
 
183
  if style_choice == "species richness (continuous)":
184
  paint_fill = richness
185
  if style_choice == "custom":
186
+ paint_fill = eval(custom)
187
 
188
 
189
  r = {
 
368
  Technical details on processing are described in the repository.
369
 
370
  '''