Spaces:
Sleeping
Sleeping
Added basemap app
Browse files- app.py +2 -1
- apps/basemaps.py +40 -0
- apps/census.py +2 -2
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
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 |
|
@@ -12,6 +12,7 @@ apps = MultiApp()
|
|
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 Gallery", deck.app)
|
16 |
apps.add_app("Home", home.app)
|
17 |
|
|
|
1 |
import streamlit as st
|
2 |
from multiapp import MultiApp
|
3 |
+
from apps import basemaps, home, census, deck, housing, upload
|
4 |
|
5 |
st.set_page_config(layout="wide")
|
6 |
|
|
|
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("Search Basemaps", basemaps.app)
|
16 |
apps.add_app("Pydeck Gallery", deck.app)
|
17 |
apps.add_app("Home", home.app)
|
18 |
|
apps/basemaps.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import leafmap.foliumap as leafmap
|
3 |
+
|
4 |
+
|
5 |
+
def app():
|
6 |
+
st.title("Searching Basemaps")
|
7 |
+
st.markdown(
|
8 |
+
"""
|
9 |
+
This app is a demonstration of searching and loading basemaps from [xyzservices](https://github.com/geopandas/xyzservices) and [Quick Map Services (QMS)](https://github.com/nextgis/quickmapservices). Selecting from 1000+ basemaps with a few clicks.
|
10 |
+
"""
|
11 |
+
)
|
12 |
+
|
13 |
+
row1_col1, row1_col2, _ = st.columns([2, 1, 0.5])
|
14 |
+
width = 800
|
15 |
+
height = 600
|
16 |
+
tiles = None
|
17 |
+
|
18 |
+
with row1_col2:
|
19 |
+
|
20 |
+
checkbox = st.checkbox("Search Quick Map Services (QMS)")
|
21 |
+
keyword = st.text_input("Enter a keyword to search and press Enter:")
|
22 |
+
empty = st.empty()
|
23 |
+
|
24 |
+
if keyword:
|
25 |
+
options = leafmap.search_xyz_services(keyword=keyword)
|
26 |
+
if checkbox:
|
27 |
+
options = options + \
|
28 |
+
leafmap.search_qms(keyword=keyword)
|
29 |
+
|
30 |
+
tiles = empty.multiselect(
|
31 |
+
"Select XYZ tiles to add to the map:", options)
|
32 |
+
|
33 |
+
with row1_col1:
|
34 |
+
m = leafmap.Map()
|
35 |
+
|
36 |
+
if tiles is not None:
|
37 |
+
for tile in tiles:
|
38 |
+
m.add_xyz_service(tile)
|
39 |
+
|
40 |
+
m.to_streamlit(width, height)
|
apps/census.py
CHANGED
@@ -15,8 +15,8 @@ def app():
|
|
15 |
else:
|
16 |
st.session_state["first_index"] = 0
|
17 |
|
18 |
-
row1_col1, row1_col2 = st.columns([2, 1])
|
19 |
-
width =
|
20 |
height = 600
|
21 |
|
22 |
census_dict = leafmap.get_census_dict()
|
|
|
15 |
else:
|
16 |
st.session_state["first_index"] = 0
|
17 |
|
18 |
+
row1_col1, row1_col2, _ = st.columns([2, 1, 0.5])
|
19 |
+
width = 800
|
20 |
height = 600
|
21 |
|
22 |
census_dict = leafmap.get_census_dict()
|