File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 1- from maplibre import MapOptions
1+ from maplibre import MapOptions , render_maplibregl
22from maplibre .basemaps import Carto
33from maplibre .controls import NavigationControl
44from maplibre .ipywidget import MapWidget as Map
5+ from maplibre .ui import use_deckgl , use_h3
6+ from shiny .express import app , ui
57
68m = Map (
79 MapOptions (
2729}
2830
2931m .add_deck_layers ([h3_hexagon_layer ], tooltip = "{{ hex }} count: {{ count }}" )
30- m .save ("/tmp/py-maplibre-express.html" )
32+
33+ use_h3 ()
34+ use_deckgl ()
35+
36+
37+ @render_maplibregl
38+ def render_map ():
39+ return m
40+
41+
42+ if __name__ == "__main__" :
43+ m .save ("/tmp/py-maplibre-express.html" , preview = True )
Original file line number Diff line number Diff line change @@ -43,6 +43,19 @@ def output_maplibregl(id_: str, height: [int | str] = 200) -> Tag:
4343
4444
4545DECKGL_VERSION = "9.0.16"
46+ H3_VERSION = "4.1.0"
47+
48+ h3_dep = HTMLDependency (
49+ name = "h3" ,
50+ version = H3_VERSION ,
51+ source = {"href" : f"https://unpkg.com/h3-js@{ H3_VERSION } /dist/" },
52+ script = {"src" : "h3-js.umd.js" },
53+ )
54+
55+
56+ def use_h3 () -> Tag :
57+ return ui .div (h3_dep )
58+
4659
4760deckgl_dep = HTMLDependency (
4861 name = "deckgl" ,
@@ -51,8 +64,6 @@ def output_maplibregl(id_: str, height: [int | str] = 200) -> Tag:
5164 script = {"src" : "dist.min.js" , "type" : "module" },
5265)
5366
54- # TODO: Remove duplicated constant
55- # DECKGL_VERSION = "9.0.16"
5667
5768deckgl_json_dep = HTMLDependency (
5869 name = "deckgljson" ,
You can’t perform that action at this time.
0 commit comments