Using Google api to get State/Country suggestions for city
I have a list of North American cities that are inconsistently paired with
provinces and countries. Example:
Calgary AB Canada
CALGARY Alberta - CA
Calgary Canada
I would like to format each city so it follows a consistent pattern. So
that it includes City State/Province and Country. Like:
Calgary Alberta Canada
I've tried using Google's Places API to get suggestions for possible
formating but all I've been able to achieve is a sort of validation that
indicates if such a city exists. I was wondering if someone who has worked
extensively with Google API's can guide me on how I can get
City/Province-State/Country suggestions ( possibly in JSON format) from a
city input.
var input = "City Name";
var service = new google.maps.places.AutocompleteService();
service.getQueryPredictions({ input: input }, callback});
I tried looking into geocoding but that seems to bring back lat/log
information.
No comments:
Post a Comment