Google 地点 API:如何在 Python 中按类型和位置搜索
Google Places API: how to search by type and location in Python
我正在按照我在 GitHub 的 main page 上找到的相对于 googlemaps
的示例,我正在编写自己的代码以从特定的位置检索所有电影院面积。
代码是这样的:
import googlemaps
gmaps = googlemaps.Client(key='MyGoogleKey')
search_loction = gmaps.location('40.714224, -73.961452').type('movie_theater')
print (search_loction)
它 returns 我的错误:
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]
是允许的
那我做错了什么?
根据documentation,你应该使用
gmaps.places(...)
以 location
作为参数。
类似
gmaps.places(location=(lat,lng), type="movie_theater")
希望对您有所帮助!
我正在按照我在 GitHub 的 main page 上找到的相对于 googlemaps
的示例,我正在编写自己的代码以从特定的位置检索所有电影院面积。
代码是这样的:
import googlemaps
gmaps = googlemaps.Client(key='MyGoogleKey')
search_loction = gmaps.location('40.714224, -73.961452').type('movie_theater')
print (search_loction)
它 returns 我的错误:
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]
是允许的
那我做错了什么?
根据documentation,你应该使用
gmaps.places(...)
以 location
作为参数。
类似
gmaps.places(location=(lat,lng), type="movie_theater")
希望对您有所帮助!