Spaces:
Sleeping
Sleeping
Add raster app
Browse files- app.py +4 -2
- apps/raster.py +73 -0
- apps/{upload.py → vector.py} +0 -0
- data/cog_files.txt +77 -0
- requirements.txt +1 -0
app.py
CHANGED
@@ -10,8 +10,9 @@ from apps import (
|
|
10 |
heatmap,
|
11 |
home,
|
12 |
housing,
|
|
|
13 |
timelapse,
|
14 |
-
|
15 |
wms,
|
16 |
)
|
17 |
|
@@ -26,7 +27,8 @@ apps.add_app("Home", home.app)
|
|
26 |
apps.add_app("Create Timelapse", timelapse.app)
|
27 |
apps.add_app("U.S. Real Estate Data", housing.app)
|
28 |
apps.add_app("U.S. Census Data", census.app)
|
29 |
-
apps.add_app("
|
|
|
30 |
apps.add_app("Search Basemaps", basemaps.app)
|
31 |
apps.add_app("Pydeck Gallery", deck.app)
|
32 |
apps.add_app("Heatmaps", heatmap.app)
|
|
|
10 |
heatmap,
|
11 |
home,
|
12 |
housing,
|
13 |
+
raster,
|
14 |
timelapse,
|
15 |
+
vector,
|
16 |
wms,
|
17 |
)
|
18 |
|
|
|
27 |
apps.add_app("Create Timelapse", timelapse.app)
|
28 |
apps.add_app("U.S. Real Estate Data", housing.app)
|
29 |
apps.add_app("U.S. Census Data", census.app)
|
30 |
+
apps.add_app("Visualize Raster Data", raster.app)
|
31 |
+
apps.add_app("Visualize Vector Data", vector.app)
|
32 |
apps.add_app("Search Basemaps", basemaps.app)
|
33 |
apps.add_app("Pydeck Gallery", deck.app)
|
34 |
apps.add_app("Heatmaps", heatmap.app)
|
apps/raster.py
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import leafmap.foliumap as leafmap
|
3 |
+
import streamlit as st
|
4 |
+
import palettable
|
5 |
+
|
6 |
+
|
7 |
+
@st.cache
|
8 |
+
def load_cog_list():
|
9 |
+
print(os.getcwd())
|
10 |
+
in_txt = os.path.join(os.getcwd(), "data/cog_files.txt")
|
11 |
+
with open(in_txt) as f:
|
12 |
+
return [line.strip() for line in f.readlines()[1:]]
|
13 |
+
|
14 |
+
|
15 |
+
@st.cache
|
16 |
+
def get_palettes():
|
17 |
+
palettes = dir(palettable.matplotlib)[:-16]
|
18 |
+
return ["matplotlib." + p for p in palettes]
|
19 |
+
|
20 |
+
|
21 |
+
def app():
|
22 |
+
|
23 |
+
st.title("Visualize Raster Datasets")
|
24 |
+
st.markdown(
|
25 |
+
"""
|
26 |
+
An interactive web app for visualizing local raster datasets and Cloud Optimized GeoTIFF ([COG](https://www.cogeo.org)). The app was built using [streamlit](https://streamlit.io), [leafmap](https://leafmap.org), and [localtileserver](https://github.com/banesullivan/localtileserver).
|
27 |
+
|
28 |
+
|
29 |
+
"""
|
30 |
+
)
|
31 |
+
|
32 |
+
row1_col1, row1_col2 = st.columns([2, 1])
|
33 |
+
|
34 |
+
with row1_col1:
|
35 |
+
cog_list = load_cog_list()
|
36 |
+
cog = st.selectbox("Select a sample Cloud Opitmized GeoTIFF (COG)", cog_list)
|
37 |
+
|
38 |
+
with row1_col2:
|
39 |
+
empty = st.empty()
|
40 |
+
|
41 |
+
url = empty.text_input(
|
42 |
+
"Enter a HTTP URL to a Cloud Optimized GeoTIFF (COG)",
|
43 |
+
cog,
|
44 |
+
)
|
45 |
+
|
46 |
+
data = st.file_uploader("Upload a raster dataset", type=["tif", "img"])
|
47 |
+
|
48 |
+
if data:
|
49 |
+
url = empty.text_input(
|
50 |
+
"Enter a URL to a Cloud Optimized GeoTIFF (COG)",
|
51 |
+
"",
|
52 |
+
)
|
53 |
+
|
54 |
+
add_palette = st.checkbox("Add a color palette")
|
55 |
+
if add_palette:
|
56 |
+
palette = st.selectbox("Select a color palette", get_palettes())
|
57 |
+
else:
|
58 |
+
palette = None
|
59 |
+
|
60 |
+
submit = st.button("Submit")
|
61 |
+
|
62 |
+
m = leafmap.Map()
|
63 |
+
|
64 |
+
if submit:
|
65 |
+
if data or url:
|
66 |
+
if data:
|
67 |
+
file_path = leafmap.save_data(data)
|
68 |
+
m.add_local_tile(file_path, palette=palette)
|
69 |
+
elif url:
|
70 |
+
m.add_remote_tile(url, palette=palette)
|
71 |
+
|
72 |
+
with row1_col1:
|
73 |
+
m.to_streamlit()
|
apps/{upload.py → vector.py}
RENAMED
File without changes
|
data/cog_files.txt
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
https://www.maxar.com/open-data/california-colorado-fires
|
2 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-02-16/pine-gulch-fire20/1030010076004E00.tif
|
3 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-08-18/pine-gulch-fire20/1040010041D3B300.tif
|
4 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-11-13/grizzly-creek-fire20/1040010045785200.tif
|
5 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-11-13/grizzly-creek-fire20/10400100443AEC00.tif
|
6 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-02-06/czu-lightning-complex-fire/104001004941E100.tif
|
7 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-02-18/cameron-peak-fire20/103001008DA5B500.tif
|
8 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-02-22/czu-lightning-complex-fire/103001008DB2E200.tif
|
9 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-04-01/grizzly-creek-fire20/104001004881EF00.tif
|
10 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-04-17/czu-lightning-complex-fire/103001008F905300.tif
|
11 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-04-17/czu-lightning-complex-fire/1030010092B22200.tif
|
12 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-06-27/czu-lightning-complex-fire/1030010094A52300.tif
|
13 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-09-08/czu-lightning-complex-fire/103001009C9FBB00.tif
|
14 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-09-24/lnu-lightning-complex-fire/103001009A079B00.tif
|
15 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-10-05/czu-lightning-complex-fire/103001009C10F800.tif
|
16 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-10-05/czu-lightning-complex-fire/103001009A266800.tif
|
17 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-11-04/czu-lightning-complex-fire/1050010019917900.tif
|
18 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-11-04/czu-lightning-complex-fire/1050010019917800.tif
|
19 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-11-18/czu-lightning-complex-fire/1050010019C2F600.tif
|
20 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-11-28/cameron-peak-fire20/103001009D72E000.tif
|
21 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-12-10/czu-lightning-complex-fire/105001001A3A8700.tif
|
22 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-12-28/lnu-lightning-complex-fire/10300100A1972700.tif
|
23 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2019-12-28/lnu-lightning-complex-fire/103001009F5D6B00.tif
|
24 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-01-15/cameron-peak-fire20/1040010057992100.tif
|
25 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-04-15/lnu-lightning-complex-fire/10300100A4B23600.tif
|
26 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-04-23/czu-lightning-complex-fire/10300100A589D100.tif
|
27 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-05-09/lnu-lightning-complex-fire/10300100A332EE00.tif
|
28 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-05-23/river-carmel-fires/10300100A77E9400.tif
|
29 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-05-23/river-carmel-fires/10300100A500A500.tif
|
30 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-05-24/river-carmel-fires/105001001D64E200.tif
|
31 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-06-27/lnu-lightning-complex-fire/10300100A8663800.tif
|
32 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-06-30/river-carmel-fires/10300100A9D60C00.tif
|
33 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-06-30/czu-lightning-complex-fire/10300100A8C66400.tif
|
34 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-06-30/czu-lightning-complex-fire/10300100A8892900.tif
|
35 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-07-11/czu-lightning-complex-fire/10300100AB381200.tif
|
36 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-07-11/czu-lightning-complex-fire/10300100AA180600.tif
|
37 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-07-13/pine-gulch-fire20/10300100AA57D700.tif
|
38 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-07-20/lnu-lightning-complex-fire/104001005C529000.tif
|
39 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2020-07-28/pine-gulch-fire20/104001005DB06E00.tif
|
40 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-14/pine-gulch-fire20/10300100AAC8DD00.tif
|
41 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-16/pine-gulch-fire20/104001005D4A6100.tif
|
42 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-17/grizzly-creek-fire20/10300100ACCA3700.tif
|
43 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-17/cameron-peak-fire20/10300100AB4ED400.tif
|
44 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-20/swir-cog/104A0100606FFE00.tif
|
45 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-20/pine-gulch-fire20/10300100ACD06200.tif
|
46 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-20/pine-gulch-fire20/10300100AAD4A000.tif
|
47 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-20/pine-gulch-fire20/10300100AA293800.tif
|
48 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-20/lnu-lightning-complex-fire/10400100606FFE00.tif
|
49 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-21/river-carmel-fires/10300100ACBA2B00.tif
|
50 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-21/river-carmel-fires/10300100AA49F600.tif
|
51 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-21/lnu-lightning-complex-fire/104001005C1AC900.tif
|
52 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-21/river-carmel-fires/104001005F9F5300.tif
|
53 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-21/river-carmel-fires/104001005F453300.tif
|
54 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-21/river-carmel-fires/10300100ADC14400.tif
|
55 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-21/czu-lightning-complex-fire/104001005F43D400.tif
|
56 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-23/grizzly-creek-fire20/104001005FA09C00.tif
|
57 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-23/grizzly-creek-fire20/104001005DC71000.tif
|
58 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-26/river-carmel-fires/105001001F58F000.tif
|
59 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-26/lnu-lightning-complex-fire/10300100AC163A00.tif
|
60 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-29/river-carmel-fires/10300100AAD27500.tif
|
61 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-08-29/river-carmel-fires/10300100A9C75A00.tif
|
62 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-09-03/cameron-peak-fire20/1040010060188800.tif
|
63 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-09-03/cameron-peak-fire20/104001005F7E6500.tif
|
64 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-09-03/cameron-peak-fire20/10300100AE685A00.tif
|
65 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-09-04/cameron-peak-fire20/1040010060761C00.tif
|
66 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-05/cameron-peak-fire20/104001006113B700.tif
|
67 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-05/cameron-peak-fire20/10400100610CD400.tif
|
68 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-12/cameron-peak-fire20/1040010062B14C00.tif
|
69 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-12/cameron-peak-fire20/10400100626BFA00.tif
|
70 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-12/cameron-peak-fire20/10400100622A6600.tif
|
71 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-12/cameron-peak-fire20/10400100606B6300.tif
|
72 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-12/cameron-peak-fire20/104001005F908800.tif
|
73 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-15/cameron-peak-fire20/10500100205EDA00.tif
|
74 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-15/cameron-peak-fire20/10500100205ED900.tif
|
75 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-22/east-troublesome-fire20/10300100B0004A00.tif
|
76 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-22/east-troublesome-fire20/10300100AD0D1200.tif
|
77 |
+
https://opendata.digitalglobe.com/events/california-fire-2020/post-event/2020-10-22/east-troublesome-fire20/10300100AD0CA600.tif
|
requirements.txt
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
geopandas
|
2 |
keplergl
|
|
|
3 |
streamlit
|
4 |
streamlit-folium
|
5 |
streamlit-keplergl
|
|
|
1 |
geopandas
|
2 |
keplergl
|
3 |
+
palettable
|
4 |
streamlit
|
5 |
streamlit-folium
|
6 |
streamlit-keplergl
|