giswqs commited on
Commit
9722c39
·
1 Parent(s): cf9d763

Added US census data app

Browse files
Files changed (3) hide show
  1. app.py +3 -2
  2. apps/census.py +35 -0
  3. apps/housing.py +1 -1
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import streamlit as st
2
  from multiapp import MultiApp
3
- from apps import home, deck, housing, upload
4
 
5
  st.set_page_config(layout="wide")
6
 
@@ -9,7 +9,8 @@ apps = MultiApp()
9
 
10
  # Add all your application here
11
 
12
- apps.add_app("Real Estate", housing.app)
 
13
  apps.add_app("Upload Vector Data", upload.app)
14
  apps.add_app("Pydeck", deck.app)
15
  apps.add_app("Home", home.app)
 
1
  import streamlit as st
2
  from multiapp import MultiApp
3
+ from apps import home, census, deck, housing, upload
4
 
5
  st.set_page_config(layout="wide")
6
 
 
9
 
10
  # Add all your application here
11
 
12
+ apps.add_app("U.S. Real Estate", housing.app)
13
+ apps.add_app("U.S. Census Data", census.app)
14
  apps.add_app("Upload Vector Data", upload.app)
15
  apps.add_app("Pydeck", deck.app)
16
  apps.add_app("Home", home.app)
apps/census.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import leafmap.foliumap as leafmap
3
+
4
+
5
+ def app():
6
+ st.title("Using U.S. Census Data")
7
+ st.markdown(
8
+ """
9
+ This app is a demonstration of using the [U.S. Census Bureau](https://www.census.gov/) TIGERweb Web Map Service (WMS). A complete list of WMS layers can be found [here](https://tigerweb.geo.census.gov/tigerwebmain/TIGERweb_wms.html).
10
+ """
11
+ )
12
+
13
+ if "first_index" not in st.session_state:
14
+ st.session_state["first_index"] = 60
15
+ else:
16
+ st.session_state["first_index"] = 0
17
+
18
+ row1_col1, row1_col2 = st.columns([2, 1])
19
+ width = 950
20
+ height = 600
21
+
22
+ census_dict = leafmap.get_census_dict()
23
+ with row1_col2:
24
+
25
+ wms = st.selectbox("Select a WMS", list(census_dict.keys()), index=11)
26
+ layer = st.selectbox(
27
+ "Select a layer",
28
+ census_dict[wms]["layers"],
29
+ index=st.session_state["first_index"],
30
+ )
31
+
32
+ with row1_col1:
33
+ m = leafmap.Map()
34
+ m.add_census_data(wms, layer)
35
+ m.to_streamlit(width, height)
apps/housing.py CHANGED
@@ -204,7 +204,7 @@ def get_saturday(in_date):
204
 
205
  def app():
206
 
207
- st.title("Real Estate Data and Market Trends")
208
  st.markdown(
209
  """**Introduction:** This interactive dashboard is designed for visualizing U.S. real estate data and market trends at multiple levels (i.e., national,
210
  state, county, and metro). The data sources include [Real Estate Data](https://www.realtor.com/research/data) from realtor.com and
 
204
 
205
  def app():
206
 
207
+ st.title("U.S. Real Estate Data and Market Trends")
208
  st.markdown(
209
  """**Introduction:** This interactive dashboard is designed for visualizing U.S. real estate data and market trends at multiple levels (i.e., national,
210
  state, county, and metro). The data sources include [Real Estate Data](https://www.realtor.com/research/data) from realtor.com and