Spaces:
Running
Running
Add anymap example
Browse files- pages/09_mgrs.py +23 -0
- pages/10_anymap.py +18 -0
- requirements.txt +1 -0
pages/09_mgrs.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import solara
|
| 2 |
+
import leafmap.maplibregl as leafmap
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def create_map():
|
| 6 |
+
|
| 7 |
+
m = leafmap.Map(
|
| 8 |
+
style="positron",
|
| 9 |
+
projection="globe",
|
| 10 |
+
height="750px",
|
| 11 |
+
zoom=2.5,
|
| 12 |
+
sidebar_visible=True,
|
| 13 |
+
)
|
| 14 |
+
geojson = "https://github.com/opengeos/datasets/releases/download/world/mgrs_grid_zone.geojson"
|
| 15 |
+
m.add_geojson(geojson)
|
| 16 |
+
m.add_labels(geojson, "GZD", text_color="white", min_zoom=2, max_zoom=10)
|
| 17 |
+
return m
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
@solara.component
|
| 21 |
+
def Page():
|
| 22 |
+
m = create_map()
|
| 23 |
+
return m.to_solara()
|
pages/10_anymap.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import solara
|
| 2 |
+
from anymap import MapLibreMap
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class Map(MapLibreMap):
|
| 6 |
+
def __init__(self, **kwargs):
|
| 7 |
+
super().__init__(**kwargs)
|
| 8 |
+
super().add_basemap("Esri.WorldImagery")
|
| 9 |
+
super().add_layer_control(collapsed=False)
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
@solara.component
|
| 13 |
+
def Page():
|
| 14 |
+
with solara.Card():
|
| 15 |
+
Map().element()
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
Page()
|
requirements.txt
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
geopandas
|
| 2 |
leafmap>=0.46.8
|
| 3 |
mapclassify
|
|
|
|
| 1 |
+
anymap
|
| 2 |
geopandas
|
| 3 |
leafmap>=0.46.8
|
| 4 |
mapclassify
|