我正在阅读Udemy的Python-folium教程。并尝试使用 folium.Map()创建地图,当我将默认图块用于Map()并另存为html文件时,它可以正常工作并在浏览器中显示地图。代码如下:
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
class Layout(BoxLayout):
# the following yields the correct height of Layout,
# which is the same as the height of the Window
def on_touch_down(self, touch):
print("inside Layout via on_touch_down:", self.height)
class MyApp(App):
def build(self):
l = Layout()
# However, accessing the height here yields the
# the default height 100
print("inside MyApp:", l.height)
return l
if __name__ == "__main__":
MyApp().run()
当我尝试将图块更改为 MapBox Bright 时,它在html页面中仅显示空白地图。
import folium
map = folium.Map(location=[42.00, -120.00], zoom_start=6)
map.save("map1.html")
现在该怎么做才能使其正常工作?