【问题标题】:Geocoder and Gmaps are not working in Jupyter Notebook地理编码器和 Gmap 在 Jupyter Notebook 中不起作用
【发布时间】:2019-10-25 18:51:46
【问题描述】:

我正在尝试使用地理编码器使用纬度和经度获得所需的高度输出,但它返回“无”作为输出。

我什至尝试使用文档代码测试地理编码器,以验证输出是否有效,但仍会收到“无”作为输出。

至于 Gmaps,它根本不想在 jupyter notebook 中显示自己。

请注意,我是 python 初学者,并试图找出问题所在,但没有结果。

import geocoder

g = geocoder.google('white house', method='places', key="API_KEY_HERE")
print(g.latlng)

g = geocoder.google([42.34539,-71.0696], method = 'elevation', key="API_KEY_HERE")
print (g.meters)
import gmaps

gmaps.configure(api_key='API_KEY_HERE')
fig = gmaps.figure()
fig

如前所述,地理编码器仅返回“无”作为输入。

Gmaps 只返回以下输出:

图(layout=FigureLayout(height='420px'))

【问题讨论】:

    标签: python google-maps jupyter-notebook geocoder


    【解决方案1】:

    当我使用无效密钥时,我也会得到“无”输出。使用有效的密钥,我会在您的第一次 Geocoder 调用中得到 [38.8976763, -77.0365298] 作为响应,同样,gmaps 库可以在我的笔记本中使用我的密钥正常工作。

    这意味着您没有使用密钥,或者正在使用无效的密钥。请确保您已启用计费、启用 Maps API(例如 Geocoding API 和 JavaScript API)并使用有效的 API 密钥。

    请参阅 Google 的 get started guide。对于 gmap,请参阅authentication guide。

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-12
      • 1970-01-01
      • 1970-01-01
      • 2018-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多