Replies: 1 comment
-
Hi @arz54, In order to run map methods, you need to wait for it to be initialized: @ui.page('/')
async def main_page():
m = ui.leaflet(center=(48.8566, 2.3522), zoom=12, options={"attributionControl": True}).classes("w-full h-screen")
m.tile_layer(url_template="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png")
m.tile_layer(url_template="https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}")
await m.initialized()
m.run_map_method(":addControl", 'new L.control.layers({"OpenStreetMap": osm, "Satellite": satellite}, {})') Note that I remove the leading colon But this code fails due to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
Hello
i'm trying to use the leaflet.js method to add the layer control button to a leaflet map in a nicegui dashboard
Actually i have a main.py who is the entry point of my dashboard.
here an example of what i'm trying to make.
thanks
Beta Was this translation helpful? Give feedback.
All reactions