当前,Google Maps Platform-Places API当前不支持在Google Maps上看到的地点类型(如所附屏幕截图中的“无家可归者收容所”)。
我们的Google问题跟踪器上已有一个功能请求,以支持Places API上的这些位置类型。为了表达您的兴趣并希望您对此请求进行任何更新,建议您给此Google Issue Tracker entry加上星号。
同时,您可能需要考虑使用其他Nearby Search或Text Search服务之类的Places API服务来获取与“无家可归者收容所”一词相匹配的地点列表。 尽管这不能保证您将获得与Google Map搜索完全相同的搜索结果,因为Google Maps Platform产品是与Google Maps Consumer应用程序(maps.google.com)分开的产品。
以下是使用python-google-places
软件包的示例请求:
使用文本搜索
from googleplaces import GooglePlaces
YOUR_API_KEY = 'YOUR_API_KEY'
google_places = GooglePlaces(YOUR_API_KEY)
query_result = google_places.text_search(
lat_lng = {'lat': 40.740614,'lng': -73.976601},query='homeless shelters',radius=5000
)
for place in query_result.places:
print(place.name)
使用附近搜索
from googleplaces import GooglePlaces
YOUR_API_KEY = 'YOUR_API_KEY'
google_places = GooglePlaces(YOUR_API_KEY)
query_result = google_places.nearby_search(
lat_lng = {'lat': 40.740614,keyword='homeless shelters',radius=5000
)
for place in query_result.places:
print(place.name)
请注意,我们还有一个official Client Libraries for Google Maps
Web Services。这是Python的特定库:
https://github.com/googlemaps/google-maps-services-python
本文链接:https://www.f2er.com/3156548.html