giswqs commited on
Commit
be2525c
·
1 Parent(s): a9cf05e

Initial commit

Browse files
.github/workflows/sync-hf.yml CHANGED
@@ -17,4 +17,4 @@ jobs:
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-template main
 
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/Amazon-ASDI main
.pre-commit-config.yaml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: check-toml
6
+ - id: check-yaml
7
+ - id: end-of-file-fixer
8
+ types: [python]
9
+ - id: trailing-whitespace
10
+ - id: requirements-txt-fixer
11
+ - id: check-added-large-files
12
+ args: ["--maxkb=500"]
13
+
14
+ - repo: https://github.com/psf/black
15
+ rev: 25.1.0
16
+ hooks:
17
+ - id: black-jupyter
18
+
19
+ - repo: https://github.com/codespell-project/codespell
20
+ rev: v2.4.1
21
+ hooks:
22
+ - id: codespell
23
+ args:
24
+ [
25
+ "--ignore-words-list=aci,acount,acounts,fallow,ges,hart,hist,nd,ned,ois,wqs,watermask,tre,mape",
26
+ "--skip=*.csv,*.geojson,*.json,*.yml*.js,*.html,*cff,*.pdf",
27
+ ]
28
+
29
+ - repo: https://github.com/kynan/nbstripout
30
+ rev: 0.8.1
31
+ hooks:
32
+ - id: nbstripout
pages/00_home.py CHANGED
@@ -5,16 +5,12 @@ import solara
5
  def Page():
6
  with solara.Column(align="center"):
7
  markdown = """
8
- ## A Solara Template for Geospatial Applications
9
-
10
- ### Introduction
11
 
12
- **A collection of [Solara](https://github.com/widgetti/solara) web apps for geospatial applications.**
13
-
14
- - Web App: <https://giswqs-solara-template.hf.space>
15
- - GitHub: <https://github.com/opengeos/solara-template>
16
- - Hugging Face: <https://huggingface.co/spaces/giswqs/solara-template>
17
 
 
18
  """
19
 
20
  solara.Markdown(markdown)
 
5
  def Page():
6
  with solara.Column(align="center"):
7
  markdown = """
8
+ ## Amazon Sustainability Data Initiative (ASDI)
 
 
9
 
10
+ An Interactive Web App for Visualizing Open Data from the Amazon Sustainability Data Initiative ([ASDI](https://exchange.aboutamazon.com/data-initiative)).
11
+ Click on the menu above to explore the data.
 
 
 
12
 
13
+ ![image](https://github.com/user-attachments/assets/8f7a18cd-bfe8-444a-add4-2d21a1830053)
14
  """
15
 
16
  solara.Markdown(markdown)
pages/01_ASDI.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import solara
2
+ import leafmap.maplibregl as leafmap
3
+
4
+
5
+ def create_map():
6
+
7
+ m = leafmap.Map(
8
+ style="liberty",
9
+ projection="globe",
10
+ height="750px",
11
+ center=[-100, 40],
12
+ zoom=2.5,
13
+ sidebar_visible=True,
14
+ )
15
+ url = "https://basemap.nationalmap.gov/arcgis/services/USGSImageryOnly/MapServer/WMSServer"
16
+ first_symbol_id = m.find_first_symbol_layer()["id"]
17
+ m.add_wms_layer(
18
+ url, layers="0", name="USGS.Imagery", visible=True, before_id=first_symbol_id
19
+ )
20
+ m.add_stac_gui()
21
+ m.add_draw_control()
22
+ return m
23
+
24
+
25
+ @solara.component
26
+ def Page():
27
+ m = create_map()
28
+ return m.to_solara()
pages/01_leafmap.py DELETED
@@ -1,33 +0,0 @@
1
- import leafmap
2
- import solara
3
-
4
- zoom = solara.reactive(2)
5
- center = solara.reactive((20, 0))
6
-
7
-
8
- class Map(leafmap.Map):
9
- def __init__(self, **kwargs):
10
- super().__init__(**kwargs)
11
- # Add what you want below
12
- self.add_stac_gui()
13
-
14
-
15
- @solara.component
16
- def Page():
17
- with solara.Column(style={"min-width": "500px"}):
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
- Map.element( # type: ignore
23
- zoom=zoom.value,
24
- on_zoom=zoom.set,
25
- center=center.value,
26
- on_center=center.set,
27
- scroll_wheel_zoom=True,
28
- toolbar_ctrl=False,
29
- data_ctrl=False,
30
- height="780px",
31
- )
32
- # solara.Text(f"Zoom: {zoom.value}")
33
- # solara.Text(f"Center: {center.value}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,3 +1,5 @@
1
- leafmap
 
 
 
2
  solara
3
- geopandas
 
1
+ geopandas
2
+ leafmap>=0.46.8
3
+ mapclassify
4
+ maplibre
5
  solara