cboettig commited on
Commit
b09697e
·
1 Parent(s): 532d930
Files changed (1) hide show
  1. app.py +27 -26
app.py CHANGED
@@ -46,35 +46,11 @@ m.add_cog_layer("https://data.source.coop/vizzuality/lg-land-carbon-data/defores
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]]]}}'
@@ -149,7 +125,32 @@ Try adding additional options to the map. For example, add the map of irrecovera
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
 
 
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
 
53
 
 
54
 
55
  # +
56
  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]]]}}'
 
125
 
126
  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)')
127
 
 
128
 
129
+ # +
130
+
131
+
132
+ ## Just for fun: further examples of adding additional layers to the application:
133
+
134
+ usgs = "https://data.source.coop/cboettig/fire/usgs-mtbs.pmtiles"
135
+ combined_style = {
136
+ "version": 8,
137
+ "sources": {
138
+ "source1": {
139
+ "type": "vector",
140
+ "url": "pmtiles://" + usgs,
141
+ "attribution": "USGS",
142
+ }
143
+ },
144
+ "layers": [
145
+ {
146
+ "id": "usgs",
147
+ "source": "source1",
148
+ "source-layer": "mtbs_perims_DD",
149
+ "type": "fill",
150
+ "paint": {"fill-color": "#FFA500", "fill-opacity": 0.2}
151
+ },
152
+ ]
153
+ }
154
 
155
+ # m.add_pmtiles(usgs, name="Fire", style=combined_style, overlay=True, show=True, zoom_to_layer=False)
156