danielle-losos commited on
Commit
bf3cf02
·
verified ·
1 Parent(s): 9af59c5

Update pages/Home.py

Browse files
Files changed (1) hide show
  1. pages/Home.py +50 -30
pages/Home.py CHANGED
@@ -1,39 +1,59 @@
1
- import streamlit as st
2
- import leafmap.foliumap as leafmap
3
 
4
- st.set_page_config(layout="wide")
5
 
6
- # Customize the sidebar
7
- markdown = """
8
- A Streamlit map template
9
- <https://github.com/opengeos/streamlit-map-template>
10
- """
 
 
11
 
12
- st.sidebar.title("About")
13
- st.sidebar.info(markdown)
14
- logo = "https://i.imgur.com/UbOXYAU.png"
15
- st.sidebar.image(logo)
16
 
17
- # Customize page title
18
- st.title("Streamlit for Geospatial Applications")
 
19
 
20
- st.markdown(
21
- """
22
- This multipage app template demonstrates various interactive web apps created using [streamlit](https://streamlit.io) and [leafmap](https://leafmap.org). It is an open-source project and you are very welcome to contribute to the [GitHub repository](https://github.com/opengeos/streamlit-map-template).
23
- """
24
- )
25
 
26
- st.header("Instructions")
27
 
28
- markdown = """
29
- 1. For the [GitHub repository](https://github.com/opengeos/streamlit-map-template) or [use it as a template](https://github.com/opengeos/streamlit-map-template/generate) for your own project.
30
- 2. Customize the sidebar by changing the sidebar text and logo in each Python files.
31
- 3. Find your favorite emoji from https://emojipedia.org.
32
- 4. Add a new app to the `pages/` directory with an emoji in the file name, e.g., `1_🚀_Chart.py`.
33
- """
34
 
35
- st.markdown(markdown)
36
 
37
- m = leafmap.Map(minimap_control=True)
38
- m.add_basemap("OpenTopoMap")
39
- m.to_streamlit(height=500)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import solara
 
2
 
 
3
 
4
+ @solara.component
5
+ def Page():
6
+ with solara.Column(align="center"):
7
+ markdown = """
8
+ ## Earth Engine Web Apps
9
+
10
+ ### Introduction
11
 
12
+ **A collection of Earth Engine web apps developed using [Solara](https://github.com/widgetti/solara) and geemap**
 
 
 
13
 
14
+ - Web App: <https://giswqs-solara-geemap.hf.space>
15
+ - GitHub: <https://github.com/opengeos/solara-geemap>
16
+ - Hugging Face: <https://huggingface.co/spaces/giswqs/solara-geemap>
17
 
18
+
19
+ ### How to deploy this app on Hugging Face Spaces
 
 
 
20
 
21
+ 1. Go to <https://huggingface.co/spaces/giswqs/solara-geemap/tree/main> and duplicate the space to your own space.
22
 
23
+ ![](https://i.imgur.com/gTg4V2x.png)
 
 
 
 
 
24
 
25
+ 2. You need to set `EARTHENGINE_TOKEN` in order to use Earth Engine. The token value should be copied from the following file depending on your operating system:
26
 
27
+ ```text
28
+ Windows: C:\\Users\\USERNAME\\.config\\earthengine\\credentials
29
+ Linux: /home/USERNAME/.config/earthengine/credentials
30
+ MacOS: /Users/USERNAME/.config/earthengine/credentials
31
+ ```
32
+
33
+ Simply open the file and copy **ALL** the content to the `EARTHENGINE_TOKEN` environment variable.
34
+
35
+ ![](https://i.imgur.com/i04gzyH.png)
36
+
37
+ ![](https://i.imgur.com/Ex37Ut7.png)
38
+
39
+
40
+ ```python
41
+ import geemap
42
+ geemap.get_ee_token()
43
+ ```
44
+
45
+ Copy all the content of the printed token and set it as the `EARTHENGINE_TOKEN` environment variable.
46
+
47
+ 3. After the space is built successfully, click the `Embed this Space` menu and find the `Direct URL` for the app, such as <https://giswqs-solara-geemap.hf.space>.
48
+
49
+ ![](https://i.imgur.com/DNM36sk.png)
50
+
51
+ ![](https://i.imgur.com/KX82lSf.png)
52
+
53
+ 4. Add your own apps (*.py) to the `pages` folder.
54
+
55
+ 5. Commit and push your changes to the repository. Wait for the space to be built successfully.
56
+
57
+ """
58
+
59
+ solara.Markdown(markdown)