Geocode returning multiple results (disambiguation)

2,308 views
Skip to first unread message

Nick Spacek

unread,
Dec 22, 2009, 10:37:51 AM12/22/09
to Google Maps JavaScript API v3
I posted this as a feature request, and wanted to make sure that there
wasn't currently an option for this (there isn't that I can tell).
Probably should have gone the other way around, but oh well.

Is there any way to have the Geocoder return multiple matching
results? For example: if I query "Halifax" I get "Halifax, England",
but I'm actually looking for "Halifax, Canada". The geocoder could
return multiple results based on the country bias and the match score.
It doesn't however, as far as I can tell.

To see what I mean:
http://www.microsoft.com/maps/isdk/ajax/
Click "Find Information (advanced)", then "Using different settings",
and enable the option "Disambiguation: custom".

Ben Appleton

unread,
Dec 22, 2009, 4:13:38 PM12/22/09
to google-map...@googlegroups.com
Hi Nick,

The geocoder already returns multiple results for ambiguous queries.
Note that the .geocode() method calls back with an array of
GeocoderResponse structs:
http://code.google.com/apis/maps/documentation/v3/reference.html#Geocoder
I'll file a bug internally to check why "Halifax, Canada" is not
returned. Note that maps.google.com (which uses the same geocoding
database) also returns just Halifax, England:
http://maps.google.com/maps?q=Halifax

Cheers
Ben

> --
>
> 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.
>
>
>

Nick Spacek

unread,
Dec 29, 2009, 7:24:19 AM12/29/09
to Google Maps JavaScript API v3
On Dec 22, 5:13 pm, Ben Appleton <apple...@google.com> wrote:
> Hi Nick,
>
> The geocoder already returns multiple results for ambiguous queries.

I realize that it is supposed to; I've just never seen it do it for
address lookups. Do you have an example? :) I've tried many and never
seen multiple results.

Nick

Jon

unread,
Dec 29, 2009, 5:45:28 PM12/29/09
to Google Maps JavaScript API v3
The geocoder doesn't seem to return multiple results for most
locations.

Example: "new london" always returns New London, CT even though there
are a bunch of them.

It does work for "mystic"... a bunch will be returned.

--Jon

paul

unread,
Dec 30, 2009, 10:40:15 AM12/30/09
to Google Maps JavaScript API v3
I would suggest passing a boundary to the geocoder in circumstances
when you want controlled results, i.e.

var southWest = new google.maps.LatLng(31.223231, -85.390489); //
Dothan, AL
var northEast = new google.maps.LatLng(34.3797125804622,
-71.7626953125); //Virginia Beach, VA
boundary = new google.maps.LatLngBounds(southWest, northEast);
if(geocoder) {
geocoder.geocode( { 'address': address, 'region': country, 'bounds':
boundary}, function(response, status) { //code } }

Nick Spacek

unread,
Dec 31, 2009, 1:55:35 PM12/31/09
to Google Maps JavaScript API v3
Since I'm not the only one experiencing, I hope we can get
clarification if this is by design or a bug. If by design, I hope that
it is recognized as a feature request! Here is the feature request I
put in:
http://code.google.com/p/gmaps-api-issues/issues/detail?id=2042

Star it if you're interested in this feature please.

Reply all
Reply to author
Forward
0 new messages