gpt4 book ai didi

python - 谷歌地方 API : how to search by type and location in Python

转载 作者:太空宇宙 更新时间:2023-11-04 00:15:35 26 4
gpt4 key购买 nike

我正在按照我在 main page 上找到的示例进行操作相对于 googlemaps 的 GitHub,我正在编写自己的代码以从特定区域检索所有电影院。

代码是这样的:

import googlemaps

gmaps = googlemaps.Client(key='MyGoogleKey')

search_loction = gmaps.location('40.714224, -73.961452').type('movie_theater')
print (search_loction)

它返回错误:

Traceback (most recent call last):
File "GoogleMap.py", line 5, in <module>
search_loction = gmaps.location('40.714224, -73.961452')
AttributeError: 'Client' object has no attribute 'location'

如果我遵循指南,是的,属性 [location] 是允许的 enter image description here

那我做错了什么?

最佳答案

根据documentation ,你应该使用

gmaps.places(...)location 作为参数。

有点像

gmaps.places(location=(lat,lng), type="movie_theater")

希望这对您有所帮助!

关于python - 谷歌地方 API : how to search by type and location in Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51080005/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com