Guest User

Untitled

a guest
May 21st, 2018
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. from googleplaces import GooglePlaces, types, lang
  2.  
  3. YOUR_API_KEY = 'AIzaSyAiFpFd85eMtfbvmVNEYuNds5TEF9FjIPI'
  4.  
  5. google_places = GooglePlaces(YOUR_API_KEY)
  6.  
  7. #Using Google Places API we can find names associated with nearby places. (Assuming this is what you wanted)
  8. def locationMatch(locArray):
  9. matchedLocation = []
  10. for i in locArray:
  11. #Iterates through each location object i and queries Google Places using the location object
  12. query_result = google_places.nearby_search(
  13. location=i,
  14. radius=20000)
  15. matchedLocation.append(query_result.place.name)
  16. #returns the list of names of nearby places which are associated.
  17. return matchedLocation
Add Comment
Please, Sign In to add comment