Geocode viewport bias not working

400 views
Skip to first unread message

helen

unread,
Jan 23, 2012, 11:59:19 AM1/23/12
to google-map...@googlegroups.com
Hello all,
I am trying to bias my geocoding results to a specific area, but it doesn't seem to be working.

Here is a link: http://50.17.249.210/demo.html

I have drawn a polygon around the bounds I am passing to the geocoding viewport so I know it is right. If you type "Queen Street" into the address field at the top, it goes to a small town nearby, instead of one of the 3 Queen Streets within the bounds (try typing "Queen St, Streetsville" or "Queen St, Port Credit" or Queen St, Brampton" and you will see them). Am I doing something wrong here? Or is this broken?

Thanks for any suggestions,

Helen

Marcelo

unread,
Jan 25, 2012, 1:48:05 AM1/25/12
to Google Maps JavaScript API v3
Quote:
"Note that biasing only prefers results within the bounds; if more
relevant results exist outside of these bounds, they may be included."
From:
http://code.google.com/apis/maps/documentation/javascript/geocoding.html#GeocodingViewports

You're only examining the first result, (results[0]). Loop through the
results array and see what else you've got, then you can check each
result against the bounds before displaying it.

--
Marcelo - http://maps.forum.nu
--

helen

unread,
Jan 26, 2012, 10:50:05 AM1/26/12
to google-map...@googlegroups.com
Well, I guess that was careless of me. In my actual site when I checked for other results I was using a different example and there was only the one result (you can try 'Lakeshore Rd', then 'Lakeshore Rd, Mississauga' and see), so I didn't check when I created the demo and suggested the 'Queen St' example.

In any case, I still don't see how a not very long street in a small town would be considered "more relevant" than the streets in the larger cities actually inside the bounds, or even a major street in the largest city in the country which is actually closer to bounds and doesn't even make it to the list. In the Queen St case, of the 3 actually within the bounds, only one even makes it to the results list at number 3. And it's not just this one street, I have other examples where a major street within the bounds is not returned at all, so checking the bounds explicitly as suggested wouldn't help (see 'Lakeshore Rd' above). This just doesn't make sense to me. The only way I can get it to return actually relevant results is a hack: I append the city name to the end of the address string if it is not there already.

Can Google provide some insight into how their 'relevance' algorithm works? Because it seems a bit wacky to me...


Rossko

unread,
Jan 26, 2012, 12:42:18 PM1/26/12
to Google Maps JavaScript API v3
> In any case, I still don't see how a not very long street in a small town
> would be considered "more relevant" than the streets in the larger cities

Where does the geocoder say it is more relevant? I interpret the docs
as meaning 'further relevant results'

> (see 'Lakeshore Rd' above)

It would appear that there is a Lakeshore Rd W and a Lakeshore Rd E in
Mississauga. I guess the geocoder thinks plain old 'Lakeshore Rd,
anytown' is a closer match to the supplied text.

> The only way I can get it to return actually relevant results is a
> hack: I append the city name to the end of the address string if it is not
> there already.

That makes sense to me. Google's geocoder is at heart not a street-
finding gazetteer, it is an address-finding service. The more your
search request looks like an address, the better it is likely to work.

helen

unread,
Jan 26, 2012, 4:05:17 PM1/26/12
to google-map...@googlegroups.com
I have always been under the impression that the geocoder results are ordered with the most relevant first, although I can't seem to find any documentation to that effect. Is this incorrect? That would certainly explain some of my issues.

I could go on providing other examples with unintuitive and/or incomplete results but I guess the point has been made to me that my expectations (and our clients) are a little too high for this service.

Thanks for your responses Rossko and Marcelo.

Rossko

unread,
Jan 26, 2012, 4:39:00 PM1/26/12
to Google Maps JavaScript API v3
I'd certainly agree that the Lakeshore Rd W/E thing could be handled
better by the geocoder. There must be thousands of similar examples,
that might require a change in the search or the source data (dunno
which, that's Googles business)

I would suggest raising a formal issue about that.
http://code.google.com/p/gmaps-api-issues/
There is an existing similar looking issue 1106
http://code.google.com/p/gmaps-api-issues/issues/detail?id=1106
perhaps that needs bumping with a 'star' and your additional evidence

But any improvement would take some time

helen

unread,
Jan 30, 2012, 9:28:23 AM1/30/12
to google-map...@googlegroups.com
Still wondering if anyone knows the answer to the question: Are geocoding results returned in any particular order? Or more specifically, is the first result the one Google thinks matches the search the closest?

Andrew Leach

unread,
Jan 30, 2012, 9:40:21 AM1/30/12
to google-map...@googlegroups.com

I believe the answer is that the order is a particular order, because
it's repeatable. But (I believe) there is no guarantee that the first
is what Google considers the closest match, and definitely no
guarantee that the first is what the user might consider the closest
match. You need to inspect all the results returned.

Reply all
Reply to author
Forward
0 new messages