如何从Google Colab笔记本中的gmplot draw命令查看html输出文件?

2024-10-02 20:30:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用colab和google地图来显示叠加在google地图上的热图图像。我做了一些研究,在这个链接中找到了两种可能的解决方案,但两种解决方案都不起作用

Display / Render an HTML file inside Jupyter Notebook on Google Colab platform

也许最近发生了一些变化? 这是我的密码:

pip install gmplot
import gmplot 
gmap1 = gmplot.GoogleMapPlotter(30.3164945, 
                                78.03219179999999, 13, apikey='AIzaSyBCyhpxDYIxIq9uINYxDK5aIjWSokUvsvY' ) 
gmap1.draw( "map11.html" ) 
import os
print(os.getcwd())
!ls

/content
map11.html  sample_data

import IPython
IPython.display.HTML(filename='/content/map11.html')

nothing is displayed. 

from IPython.display import IFrame
IFrame(src='/content/map11.html', width=900, height=600)

localhost refused to connect.

enter image description here


Tags: importoshtmlipythondisplaygoogle地图content