giswqs commited on
Commit
b056584
1 Parent(s): b651040

Added web apps

Browse files
.github/sync_to_hub.yml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Sync with Hugging Face Hub
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Sync with Hugging Face
13
+ uses: nateraw/huggingface-sync-action@v0.0.4
14
+ with:
15
+ github_repo_id: giswqs/solara-geospatial
16
+ huggingface_repo_id: giswqs/solara-geospatial
17
+ repo_type: space
18
+ space_sdk: docker
19
+ hf_token: ${{ secrets.HF_TOKEN }}
Dockerfile ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM jupyter/scipy-notebook:latest
2
+
3
+ RUN mamba install -c conda-forge leafmap geopandas localtileserver -y && \
4
+ fix-permissions "${CONDA_DIR}" && \
5
+ fix-permissions "/home/${NB_USER}"
6
+
7
+ COPY requirements.txt .
8
+ RUN pip install -r requirements.txt
9
+
10
+ RUN mkdir ./pages
11
+ COPY /pages ./pages
12
+
13
+ ENV PROJ_LIB='/opt/conda/share/proj'
14
+
15
+ USER root
16
+ RUN chown -R ${NB_UID} ${HOME}
17
+ USER ${NB_USER}
18
+
19
+ EXPOSE 8765
20
+
21
+ CMD ["solara", "run", "./pages", "--host=0.0.0.0"]
pages/00_home.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import solara
2
+
3
+ @solara.component
4
+ def Page():
5
+
6
+ markdown = """
7
+ ## Solara for Geospatial Applications
8
+
9
+ Just a proof-of-concept for now. Not all features are working yet. More features will be added in the future. Click on the menu above to see the other pages.
10
+
11
+ GitHub: <https://github.com/opengeos/solara-geospatial>
12
+
13
+ ![](https://i.imgur.com/1PbtnQE.gif)
14
+ """
15
+
16
+ solara.Markdown(markdown)
pages/01_leafmap.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ # ipyleaflet
3
+ Map visualization using [ipyleaflet](https://ipyleaflet.readthedocs.io/), a ipywidgets wrapper for [leaflet.js](https://leafletjs.com/)
4
+ """
5
+ import leafmap
6
+
7
+ import solara
8
+
9
+ zoom = solara.reactive(5)
10
+ center = solara.reactive((53.2305799, 6.5323552))
11
+
12
+
13
+ @solara.component
14
+ def Page():
15
+ with solara.Column(style={"min-width": "500px", "height": "500px"}):
16
+ # solara components support reactive variables
17
+ solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
18
+ # using 3rd party widget library require wiring up the events manually
19
+ # using zoom.value and zoom.set
20
+ leafmap.Map.element( # type: ignore
21
+ zoom=zoom.value,
22
+ on_zoom=zoom.set,
23
+ center=center.value,
24
+ on_center=center.set,
25
+ scroll_wheel_zoom=True,
26
+ )
27
+ solara.Text(f"Zoom: {zoom.value}")
28
+ solara.Text(f"Center: {center.value}")
pages/02_geemap.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ # ipyleaflet
3
+ Map visualization using [ipyleaflet](https://ipyleaflet.readthedocs.io/), a ipywidgets wrapper for [leaflet.js](https://leafletjs.com/)
4
+ """
5
+ import geemap
6
+
7
+ import solara
8
+
9
+ zoom = solara.reactive(5)
10
+ center = solara.reactive([53.2305799, 6.5323552])
11
+
12
+
13
+ @solara.component
14
+ def Page():
15
+ solara.Text("Not available yet. Check back later.")
16
+ # with solara.Column(style={"min-width": "500px", "height": "500px"}):
17
+ # # solara components support reactive variables
18
+ # solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
19
+ # # using 3rd party widget library require wiring up the events manually
20
+ # # using zoom.value and zoom.set
21
+ # geemap.Map.element( # type: ignore
22
+ # zoom=zoom.value,
23
+ # on_zoom=zoom.set,
24
+ # center=center.value,
25
+ # on_center=center.set,
26
+ # scroll_wheel_zoom=True,
27
+ # add_google_map=False,
28
+ # )
29
+ # solara.Text(f"Zoom: {zoom.value}")
30
+ # solara.Text(f"Center: {center.value}")
pages/03_mapbox.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ # ipyleaflet
3
+ Map visualization using [ipyleaflet](https://ipyleaflet.readthedocs.io/), a ipywidgets wrapper for [leaflet.js](https://leafletjs.com/)
4
+ """
5
+ import mapwidget.mapbox as mapwidget
6
+
7
+ import solara
8
+
9
+ zoom = solara.reactive(2)
10
+ center = solara.reactive((20, 0))
11
+
12
+
13
+ @solara.component
14
+ def Page():
15
+ with solara.Column(style={"min-width": "500px", "height": "500px"}):
16
+ solara.Text("Not fully working yet. Try resizing the window to use the full width.")
17
+ # solara components support reactive variables
18
+ solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
19
+ # using 3rd party widget library require wiring up the events manually
20
+ # using zoom.value and zoom.set
21
+ mapwidget.Map.element( # type: ignore
22
+ zoom=zoom.value,
23
+ center=center.value,
24
+ height='600px',
25
+ width="100%"
26
+ )
27
+ solara.Text(f"Zoom: {zoom.value}")
28
+ solara.Text(f"Center: {center.value}")
pages/04_cesium.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ # ipyleaflet
3
+ Map visualization using [ipyleaflet](https://ipyleaflet.readthedocs.io/), a ipywidgets wrapper for [leaflet.js](https://leafletjs.com/)
4
+ """
5
+ import os
6
+ import mapwidget.cesium as mapwidget
7
+
8
+ import solara
9
+
10
+ altitude = solara.reactive(400)
11
+ center = solara.reactive((37.655, -122.4175))
12
+
13
+ if os.environ.get('CESIUM_TOKEN') is None:
14
+ token = 'YOUR-CESIUM-TOKEN'
15
+ else:
16
+ token = os.environ.get('CESIUM_TOKEN')
17
+
18
+ @solara.component
19
+ def Page():
20
+ with solara.Column(style={"min-width": "500px", "height": "500px"}):
21
+ # solara components support reactive variables
22
+ solara.SliderInt(label="Zoom level", value=altitude, min=1, max=1000)
23
+ # using 3rd party widget library require wiring up the events manually
24
+ # using zoom.value and zoom.set
25
+ mapwidget.Map.element( # type: ignore
26
+ center=center.value,
27
+ altitude=altitude.value,
28
+ height='600px',
29
+ width="100%"
30
+ )
31
+
pages/05_maplibre.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ # ipyleaflet
3
+ Map visualization using [ipyleaflet](https://ipyleaflet.readthedocs.io/), a ipywidgets wrapper for [leaflet.js](https://leafletjs.com/)
4
+ """
5
+ import mapwidget.maplibre as mapwidget
6
+
7
+ import solara
8
+
9
+ zoom = solara.reactive(2)
10
+ center = solara.reactive((20, 0))
11
+
12
+
13
+ @solara.component
14
+ def Page():
15
+ with solara.Column(style={"min-width": "500px", "height": "500px"}):
16
+ solara.Text("Not fully working yet. Try resizing the window to use the full width.")
17
+
18
+ # solara components support reactive variables
19
+ solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
20
+ # using 3rd party widget library require wiring up the events manually
21
+ # using zoom.value and zoom.set
22
+ mapwidget.Map.element( # type: ignore
23
+ zoom=zoom.value,
24
+ center=center.value,
25
+ height='600px',
26
+ width="100%"
27
+ )
28
+ solara.Text(f"Zoom: {zoom.value}")
29
+ solara.Text(f"Center: {center.value}")
pages/06_openlayers.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ # ipyleaflet
3
+ Map visualization using [ipyleaflet](https://ipyleaflet.readthedocs.io/), a ipywidgets wrapper for [leaflet.js](https://leafletjs.com/)
4
+ """
5
+ import mapwidget.openlayers as mapwidget
6
+
7
+ import solara
8
+
9
+ zoom = solara.reactive(5)
10
+ center = solara.reactive((53.2305799, 6.5323552))
11
+
12
+
13
+ @solara.component
14
+ def Page():
15
+ with solara.Column(style={"min-width": "500px", "height": "500px"}):
16
+ # solara components support reactive variables
17
+ solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
18
+ # using 3rd party widget library require wiring up the events manually
19
+ # using zoom.value and zoom.set
20
+ mapwidget.Map.element( # type: ignore
21
+ zoom=zoom.value,
22
+ center=center.value,
23
+ height='600px',
24
+ width="100%"
25
+ )
26
+ # solara.Text(f"Zoom: {zoom.value}")
27
+ # solara.Text(f"Center: {center.value}")
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ geemap
2
+ leafmap
3
+ mapwidget
4
+ solara
5
+ geopandas