cboettig commited on
Commit
532d930
·
1 Parent(s): 15ec4c3
Files changed (1) hide show
  1. app.py +43 -3
app.py CHANGED
@@ -43,11 +43,39 @@ m = leafmap.Map(center=[35, -100], zoom=5)
43
  m.add_cog_layer("https://data.source.coop/vizzuality/lg-land-carbon-data/deforest_carbon_100m_cog.tif", palette="reds", name="deforested", transparent_bg=True, opacity = 0.8, zoom_to_layer=False)
44
 
45
  # m.add_cog_layer(deforest, palette="reds", name="deforested", transparent_bg=True, opacity = 0.8, zoom_to_layer=False)
46
- # 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)
47
- # m.add_cog_layer("https://data.source.coop/cboettig/carbon/cogs/vulnerable_c_total_2018.tif", palette="purples", name="vulnerable carbon", transparent_bg=True, opacity = 0.8)
48
- # m.add_cog_layer("https://data.source.coop/cboettig/carbon/cogs/irrecoverable_c_total_2018.tif", palette="greens", name="irreplacable carbon", transparent_bg=True, zoom_to_layer=False, opacity = 0.8)
49
 
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  # +
52
  polygon_ex ='{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-124.628906,34.741612],[-124.628906,42.423457],[-117.246094,42.423457],[-117.246094,34.741612],[-124.628906,34.741612]]]}}'
53
 
@@ -111,5 +139,17 @@ eval(compile(code, "<string>", "exec"))
111
  m.to_streamlit(height=700)
112
 
113
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
 
 
43
  m.add_cog_layer("https://data.source.coop/vizzuality/lg-land-carbon-data/deforest_carbon_100m_cog.tif", palette="reds", name="deforested", transparent_bg=True, opacity = 0.8, zoom_to_layer=False)
44
 
45
  # m.add_cog_layer(deforest, palette="reds", name="deforested", transparent_bg=True, opacity = 0.8, zoom_to_layer=False)
46
+ # 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)
47
+ # m.add_cog_layer("https://data.source.coop/cboettig/carbon/cogs/vulnerable_c_total_2018.tif", palette="purples", name="vulnerable carbon", transparent_bg=True, opacity = 0.8, zoom_to_layer=False)
48
+ # m.add_cog_layer("https://data.source.coop/cboettig/carbon/cogs/irrecoverable_c_total_2018.tif", palette="greens", name="irreplacable carbon", transparent_bg=True, opacity = 0.8, zoom_to_layer=False)
49
 
50
 
51
+ # +
52
+ import leafmap.foliumap as leafmap
53
+
54
+
55
+ usgs = "https://data.source.coop/cboettig/fire/usgs-mtbs.pmtiles"
56
+ combined_style = {
57
+ "version": 8,
58
+ "sources": {
59
+ "source1": {
60
+ "type": "vector",
61
+ "url": "pmtiles://" + usgs,
62
+ "attribution": "USGS",
63
+ }
64
+ },
65
+ "layers": [
66
+ {
67
+ "id": "usgs",
68
+ "source": "source1",
69
+ "source-layer": "mtbs_perims_DD",
70
+ "type": "fill",
71
+ "paint": {"fill-color": "#FFA500", "fill-opacity": 0.2}
72
+ },
73
+ ]
74
+ }
75
+
76
+
77
+ # m.add_pmtiles(usgs, name="Fire", style=combined_style, overlay=True, show=True, zoom_to_layer=False)
78
+
79
  # +
80
  polygon_ex ='{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-124.628906,34.741612],[-124.628906,42.423457],[-117.246094,42.423457],[-117.246094,34.741612],[-124.628906,34.741612]]]}}'
81
 
 
139
  m.to_streamlit(height=700)
140
 
141
 
142
+ # +
143
+ "## Explore further"
144
+
145
+ st.write('''
146
+ 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.
147
+ '''
148
+ )
149
+
150
+ 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)')
151
+
152
+ # -
153
+
154
 
155