Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

fit_bounds seems to fail when multiple maps/cells are rendered in a notebook

オープン
#2,080 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
jupyter-notebook, python

調査の方向性

添付された FitBoundsTest.txt ファイルの名前を .ipynb に変更し、複数のマップを使って Jupyter で実行します。その際、「restart kernel and run all」の実行中に、画面上での実行と画面外での実行を比較します。セルを連続して実行した場合と、失敗したセルを再実行した場合の fit_bounds のレンダリング動作を確認します。すべての再現されたマップが一貫してその境界に収まれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug
Since about September of 2024 I've noticed that folium seems to sometimes fail to correctly "apply" fit_bounds to maps when multiple maps are rendered back-to-back. Manually running map generation cells a second time seems to cause the map to zoom/fit correctly. Have others experienced this?

To Reproduce
[update] I'm happy to report that I now have a concise notebook the reproduces this issue for me consistently.
FitBoundsTest.txt Rename as .ipynb

The issue seems to be related to whether the call to the map rendering function is on or off screen at the time it gets executed. In my browsers, calling "restart kernel and run all" on this notebook causes the notebook to scroll to the start of the last cell where I have some filler_text which fills the screen, yet the last call to test() is barely visible. If I don't scroll during the execution of the cells, once the run is complete, when I do scroll up almost always the first map has not "zoomed" (fit to bounds correctly),
Screenshot from 2025-01-16 08-13-15
Sometimes the second map is also not "zoomed" correctly, but always the third is. If I remove the filler text (or move it to the top) and restart and run all again, all 3 maps "zoom" correctly. Similarly, if I scroll up to the calls to test() while it is "running all", it also succeeds every time. And, if I manually re-run a single cell that failed to zoom correctly during run all, it then zooms correctly. I hope that helps find and fix the issue. Please let me know how I can be of more assistance.

Expected behavior
All maps correctly fit to bounds as expected.

Environment (please complete the following information):

Current setup, though I've seen it in other settings as well. I believe on windows.

  • Browser: Firefox and Chrome
  • Jupyter Notebook or html files? Jupyter
  • Python version: 3.11.8
  • folium version: 0.19.4
  • branca version: 0.8.1

Additional context
Never saw this before the end of September 2024, but now see it many places.

Possible solutions
?

folium is maintained by volunteers. Can you help making a fix for this issue?
Maybe

主要言語
Python
スター
7.4k
フォーク
2.3k
平均マージ
17時間 22分
マージ済み PR(30日)
11

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python-visualization/folium のほかの issue

python-visualization/folium の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。