currently I am working with Google API for Python. I am using google Place Library as an input parameter for google Distance Matrix. This is what I have:
Dest = google_places.nearby_search(
location='Jakarta, Indonesia',
keyword='Kantor, Office, Building',
radius=random.randrange(1000,20000))
self. home = random.choice (Org)
self.destination = random.choice(Dest.places)
self.expected = gmaps.distance_matrix(random, self.destination)
And I got this series of errors
File "C:/Users/TrafficModel.py", line 52, in __init__
self.expected = gmaps.distance_matrix(self.home, self.destination)
File "C:\Python35\lib\site-packages\googlemaps\client.py", line 337, in wrapper
result = func(*args, **kwargs)
File "C:\Python35\lib\site-packages\googlemaps\distance_matrix.py", line 90, in distance_matrix
"destinations": convert.location_list(destinations)
File "C:\Python35\lib\site-packages\googlemaps\convert.py", line 128, in location_list
return "|".join([latlng(location) for location in as_list(arg)])
File "C:\Python35\lib\site-packages\googlemaps\convert.py", line 128, in <listcomp>
return "|".join([latlng(location) for location in as_list(arg)])
File "C:\Python35\lib\site-packages\googlemaps\convert.py", line 79, in latlng
normalized = normalize_lat_lng(arg)
File "C:\Python35\lib\site-packages\googlemaps\convert.py", line 107, in normalize_lat_lng
"but got %s" % type(arg).__name__)
TypeError: Expected a lat/lng dict or tuple, but got Place
I think I need to pass *args from googlePlace as tuple (or string?) as input for google distance matrix.
Many suggest to use arg = list (arg)
to unpacked the *args. But I found that's not the case.
I printed out self.destination. This is what I got:
<Place name="Menara Citicon", lat=-6.1926896, lng=106.7976679>
I think this is the problem
What should I do with this? Thanks