Geocoder fail

31 views
Skip to first unread message

amnesia7

unread,
Jul 30, 2011, 12:07:05 PM7/30/11
to google-map...@googlegroups.com
I was testing the geocoder and no matter what I type I can't get it to come back with the MEN Arena, Manchester, UK but if I put the same thing in the search on google maps it comes back with Manchester Evening News Arena, Manchester as expected.

Can someone give me a clue why this might fail.

Ta

Rossko

unread,
Jul 30, 2011, 1:19:27 PM7/30/11
to Google Maps JavaScript API v3
> I was testing the geocoder and no matter what I type I can't get it to come
> back with the MEN Arena, Manchester, UK but if I put the same thing in the
> search on google maps it comes back with Manchester Evening News Arena,
> Manchester as expected.

It's a business/facility. The geocoder searches postal addresses
only. maps.google.com searches businesses too. You might try the
Places API which includes businesses, institutions,. etc.

geoco...@gmail.com

unread,
Jul 30, 2011, 4:15:48 PM7/30/11
to Google Maps JavaScript API v3
On Jul 30, 9:07 am, amnesia7 <col.gib...@gmail.com> wrote:
> I was testing the geocoder and no matter what I type I can't get it to come
> back with the MEN Arena, Manchester, UK

If you use its address, it should work.

-- Larry

amnesia7

unread,
Jul 30, 2011, 8:43:42 PM7/30/11
to Google Maps JavaScript API v3
Yep, just tried it with the address instead and it works.....d'oh,
looks like I'll need to use the places api instead then.

Thanks both of you, it had me completely confused.

Col

amnesia7

unread,
Jul 30, 2011, 9:01:16 PM7/30/11
to Google Maps JavaScript API v3
I've just tried searching for it using the Places API (http://
code.google.com/apis/maps/documentation/javascript/examples/places-
autocomplete.html with the "All" radio button set) and it's a bit
weird.

If I try to type in "manchester evening news arena" it doesn't find
anything. However, if I search for "manchester" first to set the map
there and do another search for "manchester evening news arena" it
finds it.

Anybody got an explanation?

geoco...@gmail.com

unread,
Jul 30, 2011, 9:21:17 PM7/30/11
to Google Maps JavaScript API v3
Did you read the documentation for the places API?
http://code.google.com/apis/maps/documentation/javascript/places.html#place_searches

From my read, that behavior makes perfect sense:
+ Place Search Requests
+ Place Searches are initiated with a call to the PlacesService's
search() method.
+ This method takes a request with the following fields:
+ Either of:
+ bounds, which must be a google.maps.LatLngBounds object defining the
rectangle in which to
+ search; or
+ a location and radius; the former takes a google.maps.LatLng object,
and the radius takes a
+ simple integer, representing the circle's radius in meters.

And for autocomplete:
+ Adding Autocomplete
+ The Autocomplete constructor takes two arguments:
+ An HTML input element of type text. This is the input field that the
Autocomplete service will
+ monitor and attach its results to.
+ An options argument, which can contain:
+ types, which can be either establishment or geocode, representing
businesses or addresses,
+ respectively. If types is not specified, both types are returned.
+ bounds is a google.maps.LatLng object specifying the area in which
to search for Places. The
+ results are biased towards, but not restricted to, Places contained
within these bounds.

-- Larry

amnesia7

unread,
Jul 30, 2011, 9:36:03 PM7/30/11
to Google Maps JavaScript API v3
Thanks, just tried it again with your advice. I zoomed out to show
entire UK and then did the search and it worked, I think I was zoomed
in too much and it was just missing showing manchester at the time so
it wasn't in the "viewport".

A little annoying but I suppose its something to bear in mind.

Col



On Jul 31, 2:21 am, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Jul 30, 6:01 pm, amnesia7 <col.gib...@gmail.com> wrote:
>
> > I've just tried searching for it using the Places API (http://
> > code.google.com/apis/maps/documentation/javascript/examples/places-
> > autocomplete.html  with the "All" radio button set) and it's a bit
> > weird.
>
> > If I try to type in "manchester evening news arena" it doesn't find
> > anything. However, if I search for "manchester" first to set the map
> > there and do another search for "manchester evening news arena" it
> > finds it.
>
> > Anybody got an explanation?
>
> Did you read the documentation for the places API?http://code.google.com/apis/maps/documentation/javascript/places.html...

geoco...@gmail.com

unread,
Jul 30, 2011, 9:52:09 PM7/30/11
to Google Maps JavaScript API v3
On Jul 30, 6:36 pm, amnesia7 <col.gib...@gmail.com> wrote:
> Thanks, just tried it again with your advice. I zoomed out to show
> entire UK and then did the search and it worked, I think I was zoomed
> in too much and it was just missing showing manchester at the time so
> it wasn't in the "viewport".

If you notice the autocomplete example binds the map's bounds to the
places search. You don't have to do that. If you know the area to be
searched, provide that instead.

-- Larry

geoco...@gmail.com

unread,
Jul 30, 2011, 9:57:37 PM7/30/11
to Google Maps JavaScript API v3
On Jul 30, 6:52 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Jul 30, 6:36 pm, amnesia7 <col.gib...@gmail.com> wrote:
>
> > Thanks, just tried it again with your advice. I zoomed out to show
> > entire UK and then did the search and it worked, I think I was zoomed
> > in too much and it was just missing showing manchester at the time so
> > it wasn't in the "viewport".
>
> If you notice the autocomplete example binds the map's bounds to the
> places search. You don't have to do that.  If you know the area to be
> searched, provide that instead.

But if you know where it is already, you probably shouldn't be using
the geocoder or the places search, use the coordinates. Dynamic
searches should be used for user input.

-- Larry
Reply all
Reply to author
Forward
0 new messages