giswqs commited on
Commit
85fd537
β€’
1 Parent(s): 3619c25

Updated leafmap

Browse files
Files changed (5) hide show
  1. .github/workflows/sync-hf.yml +20 -0
  2. Dockerfile +1 -1
  3. README.md +12 -13
  4. pages/00_home.py +1 -11
  5. pages/01_leafmap.py +16 -5
.github/workflows/sync-hf.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Sync to Hugging Face hub
2
+ on:
3
+ push:
4
+ branches: [main]
5
+
6
+ # to run this workflow manually from the Actions tab
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ sync-to-hub:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ with:
15
+ fetch-depth: 0
16
+ lfs: true
17
+ - name: Push to hub
18
+ env:
19
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
20
+ run: git push --force https://giswqs:$HF_TOKEN@huggingface.co/spaces/giswqs/solara-geospatial main
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM jupyter/scipy-notebook:latest
2
 
3
  RUN mamba install -c conda-forge leafmap geopandas localtileserver -y && \
4
  fix-permissions "${CONDA_DIR}" && \
 
1
+ FROM jupyter/base-notebook:latest
2
 
3
  RUN mamba install -c conda-forge leafmap geopandas localtileserver -y && \
4
  fix-permissions "${CONDA_DIR}" && \
README.md CHANGED
@@ -1,24 +1,23 @@
1
- # solara-geospatial
 
 
 
 
 
 
 
 
 
2
 
3
  ## Introduction
4
 
5
- A collection of [solara](https://github.com/widgetti/solara) web apps for geospatial applications
6
 
7
- 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.
8
 
9
  - Web App: <https://giswqs-solara-geospatial.hf.space>
10
  - Solara-Geospatial: <https://github.com/opengeos/solara-geospatial>
11
 
12
  ## Demos
13
 
14
- ### Cesium
15
-
16
- ![](https://i.imgur.com/6quoDtN.gif)
17
-
18
- ### Mapbox
19
-
20
  ![](https://i.imgur.com/4uIEnAJ.gif)
21
-
22
- ### MapLibre
23
-
24
- ![](https://i.imgur.com/o2ZHeTL.gif)
 
1
+ ---
2
+ title: Solara Geospatial
3
+ emoji: 🌍
4
+ colorFrom: green
5
+ colorTo: red
6
+ sdk: docker
7
+ pinned: false
8
+ license: mit
9
+ app_port: 8765
10
+ ---
11
 
12
  ## Introduction
13
 
14
+ A collection of [Solara](https://github.com/widgetti/solara) web apps for geospatial applications
15
 
16
+ Just a proof-of-concept for now. Not all features are working yet. More features will be added in the future.
17
 
18
  - Web App: <https://giswqs-solara-geospatial.hf.space>
19
  - Solara-Geospatial: <https://github.com/opengeos/solara-geospatial>
20
 
21
  ## Demos
22
 
 
 
 
 
 
 
23
  ![](https://i.imgur.com/4uIEnAJ.gif)
 
 
 
 
pages/00_home.py CHANGED
@@ -8,7 +8,7 @@ def Page():
8
 
9
  ### Introduction
10
 
11
- **A collection of [solara](https://github.com/widgetti/solara) web apps for geospatial applications.**
12
 
13
  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.
14
 
@@ -17,18 +17,8 @@ def Page():
17
 
18
  ### Demos
19
 
20
- #### Cesium
21
-
22
- ![](https://i.imgur.com/6quoDtN.gif)
23
-
24
- #### Mapbox
25
-
26
  ![](https://i.imgur.com/4uIEnAJ.gif)
27
 
28
- #### MapLibre
29
-
30
- ![](https://i.imgur.com/o2ZHeTL.gif)
31
-
32
  """
33
 
34
  solara.Markdown(markdown)
 
8
 
9
  ### Introduction
10
 
11
+ **A collection of [Solara](https://github.com/widgetti/solara) web apps for geospatial applications.**
12
 
13
  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.
14
 
 
17
 
18
  ### Demos
19
 
 
 
 
 
 
 
20
  ![](https://i.imgur.com/4uIEnAJ.gif)
21
 
 
 
 
 
22
  """
23
 
24
  solara.Markdown(markdown)
pages/01_leafmap.py CHANGED
@@ -3,26 +3,37 @@
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}")
 
3
  Map visualization using [ipyleaflet](https://ipyleaflet.readthedocs.io/), a ipywidgets wrapper for [leaflet.js](https://leafletjs.com/)
4
  """
5
  import leafmap
 
6
  import solara
7
+ from leafmap.toolbar import change_basemap
8
+
9
+ zoom = solara.reactive(2)
10
+ center = solara.reactive((20, 0))
11
 
 
 
12
 
13
+ class Map(leafmap.Map):
14
+ def __init__(self, **kwargs):
15
+ super().__init__(**kwargs)
16
+ # Add what you want below
17
+ self.add_basemap("OpenTopoMap")
18
+ change_basemap(self)
19
+
20
 
21
  @solara.component
22
  def Page():
23
+ with solara.Column(style={"min-width": "500px"}):
24
  # solara components support reactive variables
25
  solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
26
  # using 3rd party widget library require wiring up the events manually
27
  # using zoom.value and zoom.set
28
+ Map.element( # type: ignore
29
  zoom=zoom.value,
30
  on_zoom=zoom.set,
31
  center=center.value,
32
  on_center=center.set,
33
  scroll_wheel_zoom=True,
34
+ toolbar_ctrl=False,
35
+ data_ctrl=False,
36
+
37
  )
38
  solara.Text(f"Zoom: {zoom.value}")
39
  solara.Text(f"Center: {center.value}")