Google Places API can’t find places by name

google-places-api

I have an application that uses the places API to help find places near destinations (like London). I prefer using nearby because it allows me to focus on one area, and it's also cheaper compared to text searches.

Unfortunately, I get answers that don't make a lot of sense. As an example, if I search for:

name=London Eye

I get zero results (with or without quotes around it).

But if I search by keyword:

keyword=ferris wheel

London Eye is returned. Here are the relevant queries:

Is there some rhyme or reason to this?

Best Answer

Well, issue is that you are using the wrong parameter.

Check the documentation and you'll see that parameter you should be using is keyword instead of name

It will be then:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=[API_KEY]&sensor=false&location=51.52864165,-0.10179430&radius=47022&keyword=%22london%20eye%22

And that's working for me!

EDIT:

As I said, if you try:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=[API_KEY]&sensor=false&location=51.52864165,-0.10179430&radius=47022&keyword=%22london%20eye%22&name=%22london%20eye%22

You get as return a lot of results better than using those parameters alone.

UPDATE

As of 2018 the name parameter was deprecated in favor of the keyword parameter, so from now on it is recommended to use only keyword parameter in your requests.

The documentation currently reads

name — A term to be matched against all content that Google has indexed for this place. Equivalent to keyword. The name field is no longer restricted to place names. Values in this field are combined with values in the keyword field and passed as part of the same search string. We recommend using only the keyword parameter for all search terms.

source: https://developers.google.com/places/web-service/search#PlaceSearchRequests

Related Topic