I’m trying make use of the Google places api autocomplete functionality.
I know this package has been installed. And I can use the maps api.
Is it possible to use the places api in code in a similar way as using the maps api?
As an example:
def submit(self, **event_args):
if self.autocomplete.text:
try:
location = GoogleMap.geocode(address=self.autocomplete.text)
except:
return
latitude = location[0].geometry.location.lat()
longitude = location[0].geometry.location.lng()
As you’ve said and shown in your example, the GoogleMap.geocode() function does what the places autocomplete API does - it returns a number of place predictions based on a search string.
To answer your question, you can use the places API in a similar way on the server but, unless I’m missing something, I don’t think you need to.
This tutorial by Ben Nuttall shows you how to use the geocode() function and in it he gets and stores the latitude and longitude like you have in your example. I’m working with limited information but I’m guessing you are looking to do something similar to him based on your example code.