Spaces:
Sleeping
Sleeping
kolibril13
commited on
Commit
•
16428a1
1
Parent(s):
74dd4d6
remove geo content
Browse files- pages/00_home.py +0 -25
- pages/01_leafmap.py +0 -35
- pages/{sine_widget.py → 01_sine_widget.py} +0 -0
- pages/02_geemap.py +0 -63
- pages/03_mapbox.py +0 -25
- pages/04_cesium.py +0 -28
- pages/05_maplibre.py +0 -26
- pages/06_openlayers.py +0 -24
- pages/07_ipyleaflet.py +0 -44
- requirements.txt +0 -4
pages/00_home.py
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
import solara
|
2 |
-
|
3 |
-
@solara.component
|
4 |
-
def Page():
|
5 |
-
|
6 |
-
markdown = """
|
7 |
-
## Solara for Geospatial Applications
|
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 |
-
|
15 |
-
- Web App: <https://giswqs-solara-geospatial.hf.space>
|
16 |
-
- GitHub: <https://github.com/opengeos/solara-geospatial>
|
17 |
-
- Hugging Face: <https://huggingface.co/spaces/giswqs/solara-geospatial>
|
18 |
-
|
19 |
-
### Demos
|
20 |
-
|
21 |
-
![](https://i.imgur.com/4uIEnAJ.gif)
|
22 |
-
|
23 |
-
"""
|
24 |
-
|
25 |
-
solara.Markdown(markdown)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/01_leafmap.py
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
import leafmap
|
2 |
-
import solara
|
3 |
-
from leafmap.toolbar import change_basemap
|
4 |
-
|
5 |
-
zoom = solara.reactive(2)
|
6 |
-
center = solara.reactive((20, 0))
|
7 |
-
|
8 |
-
|
9 |
-
class Map(leafmap.Map):
|
10 |
-
def __init__(self, **kwargs):
|
11 |
-
super().__init__(**kwargs)
|
12 |
-
# Add what you want below
|
13 |
-
self.add_basemap("OpenTopoMap")
|
14 |
-
change_basemap(self)
|
15 |
-
|
16 |
-
|
17 |
-
@solara.component
|
18 |
-
def Page():
|
19 |
-
with solara.Column(style={"min-width": "500px"}):
|
20 |
-
# solara components support reactive variables
|
21 |
-
# solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
|
22 |
-
# using 3rd party widget library require wiring up the events manually
|
23 |
-
# using zoom.value and zoom.set
|
24 |
-
Map.element( # type: ignore
|
25 |
-
zoom=zoom.value,
|
26 |
-
on_zoom=zoom.set,
|
27 |
-
center=center.value,
|
28 |
-
on_center=center.set,
|
29 |
-
scroll_wheel_zoom=True,
|
30 |
-
toolbar_ctrl=False,
|
31 |
-
data_ctrl=False,
|
32 |
-
|
33 |
-
)
|
34 |
-
solara.Text(f"Zoom: {zoom.value}")
|
35 |
-
solara.Text(f"Center: {center.value}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/{sine_widget.py → 01_sine_widget.py}
RENAMED
File without changes
|
pages/02_geemap.py
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
|
2 |
-
import ee
|
3 |
-
import geemap
|
4 |
-
|
5 |
-
import solara
|
6 |
-
|
7 |
-
zoom = solara.reactive(4)
|
8 |
-
center = solara.reactive([40, -100])
|
9 |
-
|
10 |
-
|
11 |
-
class Map(geemap.Map):
|
12 |
-
def __init__(self, **kwargs):
|
13 |
-
super().__init__(**kwargs)
|
14 |
-
self.add_ee_data()
|
15 |
-
self.add_layer_manager()
|
16 |
-
self.add_inspector()
|
17 |
-
|
18 |
-
|
19 |
-
def add_ee_data(self):
|
20 |
-
|
21 |
-
# Add Earth Engine dataset
|
22 |
-
dem = ee.Image('USGS/SRTMGL1_003')
|
23 |
-
landsat7 = ee.Image('LANDSAT/LE7_TOA_5YEAR/1999_2003').select(
|
24 |
-
['B1', 'B2', 'B3', 'B4', 'B5', 'B7']
|
25 |
-
)
|
26 |
-
states = ee.FeatureCollection("TIGER/2018/States")
|
27 |
-
|
28 |
-
# Set visualization parameters.
|
29 |
-
vis_params = {
|
30 |
-
'min': 0,
|
31 |
-
'max': 4000,
|
32 |
-
'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5'],
|
33 |
-
}
|
34 |
-
|
35 |
-
# Add Earth Engine layers to Map
|
36 |
-
self.addLayer(dem, vis_params, 'SRTM DEM', True, 0.5)
|
37 |
-
self.addLayer(
|
38 |
-
landsat7,
|
39 |
-
{'bands': ['B4', 'B3', 'B2'], 'min': 20, 'max': 200, 'gamma': 2.0},
|
40 |
-
'Landsat 7', False
|
41 |
-
)
|
42 |
-
self.addLayer(states, {}, "US States")
|
43 |
-
|
44 |
-
|
45 |
-
@solara.component
|
46 |
-
def Page():
|
47 |
-
with solara.Column(style={"min-width": "500px"}):
|
48 |
-
# solara components support reactive variables
|
49 |
-
# solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
|
50 |
-
# using 3rd party widget library require wiring up the events manually
|
51 |
-
# using zoom.value and zoom.set
|
52 |
-
Map.element( # type: ignore
|
53 |
-
zoom=zoom.value,
|
54 |
-
on_zoom=zoom.set,
|
55 |
-
center=center.value,
|
56 |
-
on_center=center.set,
|
57 |
-
scroll_wheel_zoom=True,
|
58 |
-
add_google_map=True,
|
59 |
-
height="700px"
|
60 |
-
|
61 |
-
)
|
62 |
-
solara.Text(f"Zoom: {zoom.value}")
|
63 |
-
solara.Text(f"Center: {center.value}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/03_mapbox.py
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
|
2 |
-
import mapwidget.mapbox as mapwidget
|
3 |
-
|
4 |
-
import solara
|
5 |
-
|
6 |
-
zoom = solara.reactive(2)
|
7 |
-
center = solara.reactive((20, 0))
|
8 |
-
|
9 |
-
|
10 |
-
@solara.component
|
11 |
-
def Page():
|
12 |
-
with solara.Column(style={"min-width": "500px", "height": "500px"}):
|
13 |
-
solara.Text("Not fully working yet. Try resizing the window to use the full width.")
|
14 |
-
# solara components support reactive variables
|
15 |
-
solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
|
16 |
-
# using 3rd party widget library require wiring up the events manually
|
17 |
-
# using zoom.value and zoom.set
|
18 |
-
mapwidget.Map.element( # type: ignore
|
19 |
-
zoom=zoom.value,
|
20 |
-
center=center.value,
|
21 |
-
height='600px',
|
22 |
-
width="100%"
|
23 |
-
)
|
24 |
-
solara.Text(f"Zoom: {zoom.value}")
|
25 |
-
solara.Text(f"Center: {center.value}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/04_cesium.py
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
|
2 |
-
import os
|
3 |
-
import mapwidget.cesium as mapwidget
|
4 |
-
|
5 |
-
import solara
|
6 |
-
|
7 |
-
altitude = solara.reactive(400)
|
8 |
-
center = solara.reactive((37.655, -122.4175))
|
9 |
-
|
10 |
-
if os.environ.get('CESIUM_TOKEN') is None:
|
11 |
-
token = 'YOUR-CESIUM-TOKEN'
|
12 |
-
else:
|
13 |
-
token = os.environ.get('CESIUM_TOKEN')
|
14 |
-
|
15 |
-
@solara.component
|
16 |
-
def Page():
|
17 |
-
with solara.Column(style={"min-width": "500px", "height": "500px"}):
|
18 |
-
# solara components support reactive variables
|
19 |
-
solara.SliderInt(label="Zoom level", value=altitude, min=1, max=1000)
|
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 |
-
center=center.value,
|
24 |
-
altitude=altitude.value,
|
25 |
-
height='600px',
|
26 |
-
width="100%"
|
27 |
-
)
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/05_maplibre.py
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
|
2 |
-
import mapwidget.maplibre as mapwidget
|
3 |
-
|
4 |
-
import solara
|
5 |
-
|
6 |
-
zoom = solara.reactive(2)
|
7 |
-
center = solara.reactive((20, 0))
|
8 |
-
|
9 |
-
|
10 |
-
@solara.component
|
11 |
-
def Page():
|
12 |
-
with solara.Column(style={"min-width": "500px", "height": "500px"}):
|
13 |
-
solara.Text("Not fully working yet. Try resizing the window to use the full width.")
|
14 |
-
|
15 |
-
# solara components support reactive variables
|
16 |
-
solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
|
17 |
-
# using 3rd party widget library require wiring up the events manually
|
18 |
-
# using zoom.value and zoom.set
|
19 |
-
mapwidget.Map.element( # type: ignore
|
20 |
-
zoom=zoom.value,
|
21 |
-
center=center.value,
|
22 |
-
height='600px',
|
23 |
-
width="100%"
|
24 |
-
)
|
25 |
-
solara.Text(f"Zoom: {zoom.value}")
|
26 |
-
solara.Text(f"Center: {center.value}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/06_openlayers.py
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
|
2 |
-
import mapwidget.openlayers as mapwidget
|
3 |
-
|
4 |
-
import solara
|
5 |
-
|
6 |
-
zoom = solara.reactive(5)
|
7 |
-
center = solara.reactive((53.2305799, 6.5323552))
|
8 |
-
|
9 |
-
|
10 |
-
@solara.component
|
11 |
-
def Page():
|
12 |
-
with solara.Column(style={"min-width": "500px", "height": "500px"}):
|
13 |
-
# solara components support reactive variables
|
14 |
-
solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
|
15 |
-
# using 3rd party widget library require wiring up the events manually
|
16 |
-
# using zoom.value and zoom.set
|
17 |
-
mapwidget.Map.element( # type: ignore
|
18 |
-
zoom=zoom.value,
|
19 |
-
center=center.value,
|
20 |
-
height='600px',
|
21 |
-
width="100%"
|
22 |
-
)
|
23 |
-
# solara.Text(f"Zoom: {zoom.value}")
|
24 |
-
# solara.Text(f"Center: {center.value}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/07_ipyleaflet.py
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
import ipyleaflet
|
2 |
-
import solara
|
3 |
-
import ipywidgets as widgets
|
4 |
-
|
5 |
-
zoom = solara.reactive(2)
|
6 |
-
center = solara.reactive((20, 0))
|
7 |
-
|
8 |
-
|
9 |
-
class Map(ipyleaflet.Map):
|
10 |
-
def __init__(self, **kwargs):
|
11 |
-
super().__init__(**kwargs)
|
12 |
-
self.layout.height = '600px'
|
13 |
-
# Add what you want below
|
14 |
-
|
15 |
-
label = widgets.Label('Clicked location')
|
16 |
-
output = widgets.Output()
|
17 |
-
widget = widgets.VBox([label, output])
|
18 |
-
control = ipyleaflet.WidgetControl(widget=widget, position='bottomright')
|
19 |
-
self.add_control(control)
|
20 |
-
|
21 |
-
def handle_interaction(**kwargs):
|
22 |
-
latlon = kwargs.get("coordinates")
|
23 |
-
if kwargs.get("type") == "click":
|
24 |
-
with output:
|
25 |
-
output.clear_output()
|
26 |
-
print(latlon)
|
27 |
-
|
28 |
-
self.on_interaction(handle_interaction)
|
29 |
-
|
30 |
-
|
31 |
-
@solara.component
|
32 |
-
def Page():
|
33 |
-
with solara.Column(style={"min-width": "500px"}):
|
34 |
-
solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
|
35 |
-
Map.element(
|
36 |
-
zoom=zoom.value,
|
37 |
-
on_zoom=zoom.set,
|
38 |
-
center=center.value,
|
39 |
-
on_center=center.set,
|
40 |
-
scroll_wheel_zoom=True,
|
41 |
-
|
42 |
-
)
|
43 |
-
solara.Text(f"Zoom: {zoom.value}")
|
44 |
-
solara.Text(f"Center: {center.value}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
@@ -1,6 +1,2 @@
|
|
1 |
-
geemap>=0.21.0
|
2 |
-
leafmap
|
3 |
-
mapwidget
|
4 |
ipyreact
|
5 |
solara
|
6 |
-
geopandas
|
|
|
|
|
|
|
|
|
1 |
ipyreact
|
2 |
solara
|
|