2
Google Nearby Search에서 장소를 가져 오는 데 다음 코드를 사용했습니다.Google 주변 검색과의 거리
from googleplaces import GooglePlaces, types, lang
YOUR_API_KEY = 'AIzaSyAiFpFd85eMtfbvmVNEYuNds5TEF9FjIPI'
google_places = GooglePlaces(YOUR_API_KEY)
query_result = google_places.query(
location='London, England', keyword='Fish and Chips',
radius=20000, types=[types.TYPE_FOOD])
if query_result.has_attributions:
print query_result.html_attributions
for place in query_result.places:
# Returned places from a query are place summaries.
print place.name
print place.geo_location
print place.reference
# The following method has to make a further API call.
place.get_details()
# Referencing any of the attributes below, prior to making a call to
# get_details() will raise a googleplaces.GooglePlacesAttributeError.
print place.details # A dict matching the JSON response from Google.
print place.local_phone_number
print place.international_phone_number
print place.website
print place.url
주어진 위치와 반경에 대한 장소 목록의 json 출력이 있습니다. 나는 json에서 이름, 주소, 위도, 경도를 검색했다. 나는 또한 그 장소의 거리가 필요하다. 그러나 그것을 발견 할 수 없다. 누군가 제발 도와주세요.
감사합니다를 회신 선생님을 위해. 그러나 나는 이것을 보았다. 출발지와 목적지가 필요합니다. – ToothLess
예. 현재 주소를 알아낼 수 있어야합니다. 목적지의 경우 Google 위치 URL에서 검색 할 수 있어야합니다. 따라서 Google 지역 정보 API에서 검색 한 각 결과에 대해 destination_address 매개 변수로 사용해야합니다. – Rudy