question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Map.fit_bounds() has no effect on Xeus-Python kernel in JupyterLab 3

See original GitHub issue

It seems like map.fit_bounds() does not have any effect when run on the Xeus-Python (Python 3.8 (XPython)), but works as expected on the “normal” Python 3 kernel. The same effect can be seen when running in the “normal” mode (not the “simple” one in which the screenshots below were made) and when running as a “classic” notebook (after pressing “Help -> Launch Classic Notebook”).

This took me a while to find out and I’m opening it here first, but I’ve opened one on Xeus kernel as a cross-reference: https://github.com/jupyter-xeus/xeus-python/issues/432. I’m using JupyterLab 3.0.10.


import ipyleaflet

print(ipyleaflet.__version__)
m = ipyleaflet.Map(center=[0, 0], zoom=1)

((s, w), (n, e)) = ((42, -6), (52, 9))
m += ipyleaflet.Polygon(locations=[(s, w), (n, w), (n, e), (s, e)])

# No effect under Xeus-Python (Python 3.8 (XPython)) kernel,
# but as expected under Python 3 kernel:
m.fit_bounds(((s, w), (n, e)))

m
Screenshot 2021-03-23 at 08 51 47 Screenshot 2021-03-23 at 08 50 32

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
davidbrochartcommented, Mar 23, 2021

I think it is because xeus-python doesn’t have event loop integration as ipykernel has. We could also implement fit_bounds() using https://github.com/mapbox/mercantile, which would work with all python kernels, but that would only work for Mercator projections. Maybe this is fine.

0reactions
martinRenoucommented, Mar 23, 2021

Oh, I thought fit_bounds was using comm messages, but it actually doesn’t do that. Then what I said is not valid.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Map.fit_bounds() has no effect on Xeus-Python ... - GitHub
I'm not sure this is an issue with Xeus-Python, but I've observed it under this kernel only in the context of using ipyleaflet...
Read more >
Google maps fitBounds() does not work as expected
I try to zoom to a number of km on a location (Paris, in my case), like this: map.myCircle = circle; // update...
Read more >
xeus-python
xeus-python is a Jupyter kernel for Python based on the native implementation of the Jupyter protocol xeus. INSTALLATION.
Read more >
Jupyter / IPython: After editing a module, changes are not ...
Jupyter / IPython: After editing a module, changes are not effective without kernel restart · 1) The simplest and most certain is to...
Read more >
Visual Debugger for Jupyter Lab - Medium
I will explain how to install and use the visual Jupyter Debugger for Jupyter Labs using the Xeus-python kernel. The prerequisites are:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found