The geocoder is - just that - a geocoder. It's for turning a fully formed string into a coordinate. Its expected that the entered string should match one location.
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. On 7 April 2011 08:55, unxposed <[email protected]> wrote: > I am creating a smart location form field with jquery autocomplete and > google geocode. > > One of the two major problems I am having is this: > > If I type in 'L' I would like some relevent suggestions (influenced by > the region parameter) of the most likely locations I would be > entering. For example, if I do this in maps.google.co.uk I get > 'London, Leeds, Liverpool, Leicester, Luton'... Perfect!! However > using the api's geocode service I get 1 result - 'Limburg, The > Netherlands'... WTF? Where's this come from? Why just 1 result? Am I > missing some settings somewhere? > > geocoder.geocode( { 'address': request.term, 'region': 'GB' }, > function(results, status) { > response($.map(results, function(item) { > for(var i in item.types) { > if (item.types[i] == 'political') { > return { > label: item.formatted_address, > value: item.formatted_address, > latitude: item.geometry.location.lat(), > longitude: item.geometry.location.lng() > } > } > } > })); > }) > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-maps-js-api-v3?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
