Topic: Google Autocomplete API to get locations around the user's GPS?
I have been able to implement the Autocomplete example as per this:
https://infinity-code.com/atlas/online- … ample.html
Google's API has a way to limit or focus the results by GPS as this is typically needed:
https://developers.google.com/maps/docu … tocomplete
"You may bias results to a specified circle by passing a location and a radius parameter. Doing so instructs the Places service to prefer showing results within that circle; results outside of the defined area may still be displayed."
I have tried using the following:
OnlineMapsGooglePlacesAutocomplete.Params autoCompleteParams = new OnlineMapsGooglePlacesAutocomplete.Params {
key = apiKey,
location = currentLocation, //long,lat as Vector2
radius = 10 * 1000, //meters (ie. km * 1000)
};
OnlineMapsGooglePlacesAutocomplete.Find(searchString, autoCompleteParams).OnComplete += autoCompleteReturned;
However, this does not seem to be working properly. I am not getting reliably biased results to my area. I wonder if there some error in implementation.
For example, if I start typing my home address or a nearby address in, I am still getting very far away results unless I go very far with the typing to almost completely spell it out. Or if I type a chain like Starbucks or McDonald's or a gas station brand, I still find some far away results ahead of close ones. It is better than not giving any location or radius but still not as good as expected.
Can you test this on your end perhaps to confirm if it is working as expected or let me know if there's any easy way to test it objectively against Google's standard?
I also note that "result.description" tends to return addresses of places like this: "McDonald's, Grace Street, City, Province/State, Country." ie. There is no street #. How do we get the full address with street #?
Is there a way to get the result broken down into these components like city, country, street number/name, facility name as separate fields? Also is GPS of the location stored in result too?
Thanks for your help.