Google doesnt expose a 'auto-complete' service. They have one for
Google Maps, but its not exposed as an API.
... so you need to build your own.
The data from geonames.org can be used.
> --
> You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
> To post to this group, send email to google-map...@googlegroups.com.
> To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
>
A pile of logs essentially works as a ladder too. Doesn't mean you
should use them. Better to use a ladder - designed for purpose.
> For example if I type in 'Li' to my search box I get back
> 'Liechtenstein, Limburg, The Netherlands, Limburg, Belgium, Leghorn,
> Italy'. Why are these the results being returned? If 'Li' does not
> match an exact location anywhere, then why not simply look at my
> region parameter and use that to influence the results - returning the
> most likely locations that contain 'Li' first (determined by populus
> or a slightly more clever algorithm) and limiting the results to X -
> which would be passed as a parameter.
That's is what a location search might do. But the geocoder isn't a
location search, its a Geocoder.
>
> I know you're saying unless 'Li' is an actual place then it shouldn't
> be passed to the geocoding service in the first place. But it surely
> wouldn't be hard for Google to make the results a bit more relevent
> and consistent in this eventuality, it would be a REALLY useful tool
> and it would be nice for Google to open up their database to be
> searched in this way.
It would be very nice for Google to offer such a service.
A request here:
http://code.google.com/p/gmaps-api-issues/issues/detail?id=2780
(star the request)
> I find it hard to believe that in 2011 there
> isn't a standard and easy way of turning a form field into a smart
> location autocomplete field.
>
> I'm trying to get my head around how I'd go about doing this using
> something like geonames.org as an alternative. It seems the countries
> are limited and must be specified - so no global search?
Well, they provide many APIs you can use. But also the data so can
download it and put it in your own database. Can then implement what
ever logic you like.
But this looks interesting:
http://1300grams.com/2009/08/17/jquery-autocomplete-with-json-jsonp-support-and-overriding-the-default-search-parameter-q/