cboettig commited on
Commit
007a1d6
·
1 Parent(s): 10dee0b
Files changed (3) hide show
  1. .gitignore +8 -0
  2. app.py +56 -0
  3. requirements.txt +8 -0
.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ .Rproj.user
2
+ .Rhistory
3
+ .RData
4
+ .Ruserdata
5
+ .ipynb_checkpoints
6
+ pad-us.Rproj
7
+ *.vrt
8
+ mobi-red
app.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Licensed under the Apache License, Version 2.0 (the "License");
3
+ # you may not use this file except in compliance with the License.
4
+ # You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ import leafmap.foliumap as leafmap
15
+ import streamlit as st
16
+ import altair as alt
17
+ import ibis
18
+ from ibis import _
19
+ import ibis.selectors as s
20
+
21
+
22
+ # +
23
+ st.set_page_config(layout="wide", page_title="Leafmap Explorer", page_icon="⚡")
24
+
25
+ '''
26
+ # Leafmap explorer
27
+
28
+ '''
29
+ # -
30
+
31
+ code = '''
32
+ m = leafmap.Map(center=[35, -100], zoom=3)
33
+ 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)
34
+ 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)
35
+ m.add_cog_layer("https://data.source.coop/cboettig/carbon/cogs/manageable_c_total_2018.tif", palette="greens", name="manageable carbon", transparent_bg=True, opacity = 0.8)
36
+ '''
37
+
38
+
39
+ # +
40
+ ## Map controls sidebar
41
+
42
+ with st.sidebar:
43
+
44
+ "## Map controls"
45
+
46
+ code = st.text_area(
47
+ label = "Python code",
48
+ value = code,
49
+ height = 400)
50
+
51
+ # -
52
+
53
+
54
+ eval(code)
55
+ m.to_streamlit(height=700)
56
+
requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ pandas
2
+ pydeck
3
+ pmtiles
4
+ streamlit
5
+ leafmap
6
+ ibis-framework[duckdb]
7
+ altair
8
+