On 7 April 2011 13:08, unxposed <[email protected]> wrote: > Okay. But it essentially acts as an auto-complete search tool as well.
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/ > > > > On Apr 7, 11:45 am, Barry Hunter <[email protected]> wrote: >> 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 >> > athttp://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. > > -- 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.
