cboettig commited on
Commit
9bc0dd6
·
1 Parent(s): 1946dc1
Files changed (1) hide show
  1. app.py +37 -4
app.py CHANGED
@@ -123,18 +123,30 @@ m.to_streamlit(height=700)
123
  "## Explore further"
124
 
125
  st.write('''
126
- Try adding additional options to the map. For example, add the map of irrecoverable carbon in 2018 as an overlay layer by pasting the code below into the python code box on the left.
 
 
 
 
127
  '''
128
  )
129
 
130
- st.code('m.add_cog_layer("https://data.source.coop/cboettig/carbon/cogs/irrecoverable_c_total_2018.tif", palette="reds", name="irrecoverable carbon", transparent_bg=True, opacity = 0.8, zoom_to_layer=False)')
131
 
132
 
133
  # +
134
 
135
 
136
- ## Just for fun: further examples of adding additional layers to the application:
 
 
 
 
137
 
 
 
 
 
 
138
  usgs = "https://data.source.coop/cboettig/fire/usgs-mtbs.pmtiles"
139
  combined_style = {
140
  "version": 8,
@@ -156,5 +168,26 @@ combined_style = {
156
  ]
157
  }
158
 
159
- # m.add_pmtiles(usgs, name="Fire", style=combined_style, overlay=True, show=True, zoom_to_layer=False)
 
 
 
 
 
 
 
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  "## Explore further"
124
 
125
  st.write('''
126
+ Try adding additional options to the map. Some suggested examples are shown below.
127
+ (Of course any self-respecting streamlit app would make these into toggle buttons,
128
+ but this is a demo and it's fun & flexible to be able to execute arbitrary code).
129
+
130
+ To explore further, simply modify the Streamlit app.py file from the Files menu up top!
131
  '''
132
  )
133
 
 
134
 
135
 
136
  # +
137
 
138
 
139
+ st.code('''
140
+
141
+ # irrecoverable carbon (Conservation International):
142
+ "https://data.source.coop/cboettig/carbon/cogs/irrecoverable_c_total_2018.tif"
143
+ m.add_cog_layer(, palette="reds", name="irrecoverable carbon", transparent_bg=True, opacity = 0.8, zoom_to_layer=False)')
144
 
145
+ # Human Impacts, Vizzuality
146
+ url="https://data.source.coop/vizzuality/hfp-100/hfp_2021_100m_v1-2_cog.tif"
147
+ m.add_cog_layer(url, palette="purples", name="human impact", transparent_bg=True, opacity = 0.8, zoom_to_layer=False)
148
+
149
+ # Fire Polygons, USGS
150
  usgs = "https://data.source.coop/cboettig/fire/usgs-mtbs.pmtiles"
151
  combined_style = {
152
  "version": 8,
 
168
  ]
169
  }
170
 
171
+ m.add_pmtiles(usgs, name="Fire", style=combined_style, overlay=True, show=True, zoom_to_layer=False)
172
+ ''')
173
+
174
+
175
+
176
+
177
+ # +
178
+ st.divider()
179
 
180
+ '''
181
+ ## Credits
182
+
183
+ ### Data sources
184
+
185
+ - Carbon-loss by Vizzuality, on https://beta.source.coop/repositories/vizzuality/lg-land-carbon-data. citation: https://doi.org/10.1101/2023.11.01.565036, License: CC-BY
186
+ - Human Footprint by Vizzuality, on https://beta.source.coop/repositories/vizzuality/hfp-100, citation: https://doi.org/10.3389/frsen.2023.1130896, License: Public Domain
187
+ - Fire polygons by USGS, reprocessed to PMTiles on https://beta.source.coop/cboettig/fire/, License: Public Domain.
188
+ - Irrecoverable Carbon from Conservation International, reprocessed to COG on https://beta.source.coop/cboettig/carbon, citation: https://doi.org/10.1038/s41893-021-00803-6, License: CC-BY-NC
189
+
190
+ Software stack: Streamlit (python) app hosted on free-tier HuggingFace spaces. Mapping with Leafmap.
191
+
192
+
193
+ '''