使用以下代码,我希望获得可见地图的经纬度对:
import folium
testmap = folium.Map(location=[-23.52, 115.5]
, zoom_start=7
, prefer_canvas=True
)
testmap.get_bounds()相反,我得到的是:
[[None, None], [None, None]]我做错了什么?我正在使用主分支的Folium,如果这有助于解决这个问题的话。
发布于 2019-04-03 13:17:39
看看这是否对你有帮助:https://nbviewer.jupyter.org/gist/ocefpaf/815b267199a1c1d4ac43f37cf8b8d4a8
这为您提供了如何正确使用get_bounds的示例
发布于 2020-08-05 16:18:17
我也遇到了这个问题,我没有解决方案,但我知道在查看get_bounds()函数的实现时会发生什么。
def get_bounds(self):
"""Computes the bounds of the object and all it's children
in the form [[lat_min, lon_min], [lat_max, lon_max]].
"""
bounds = self._get_self_bounds()
for child in self._children.values():
child_bounds = child.get_bounds()
def _get_self_bounds(self):
"""Computes the bounds of the object itself (not including it's children)
in the form [[lat_min, lon_min], [lat_max, lon_max]]
"""
return [[None, None], [None, None]]因此,首先计算map本身的边界(返回None值),然后计算子节点的边界。由于在您的示例中没有子级,因此get_bounds()函数返回[[None, None], [None, None]]。
https://stackoverflow.com/questions/55487424
复制相似问题