eoda-dev / py-maplibregl

Python bindings for MapLibre GL JS
https://eoda-dev.github.io/py-maplibregl/
MIT License
43 stars 5 forks source link

Change map center and zoom programmatically #39

Closed giswqs closed 7 months ago

giswqs commented 7 months ago

Is it possible to change the map center and zoom level programmatically in Jupyter? It would be very useful to change the map center and zoom (or fit bounds) after adding a new layer.

giswqs commented 7 months ago

I figured it out. Map center and zoom can be changed programmatically as follows:

m.add_call("setCenter", [-100, 40])
m.add_call("setZoom", 3)