eodaGmbH / py-maplibregl

Python bindings for MapLibre GL JS
https://eodagmbh.github.io/py-maplibregl/
MIT License
27 stars 2 forks source link

Change map center and zoom programmatically #39

Closed giswqs closed 2 months ago

giswqs commented 2 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 2 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)