How to find a business name using only the address with Google Place Search API?

Viewed 910

There is a Five Guys restaurant at 1628 Shore Pkwy, Brooklyn, NY 11214. But if make the following request:

https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=1628+Shore+Pkwy,+Brooklyn,+NY+1214&inputtype=textquery&fields=name,formatted_address,place_id,geometry/location,types&key=XXXXX

I get only data about the location:

{
   "candidates" : [
      {
         "formatted_address" : "1628 Shore Pkwy, Brooklyn, NY 11214, EUA",
         "geometry" : {
            "location" : {
               "lat" : 40.59517870000001,
               "lng" : -74.0002082
            }
         },
         "name" : "1628 Shore Pkwy",
         "place_id" : "ChIJaR1SsaZFwokRx_mn6wlXDSw",
         "types" : [ "premise" ]
      }
   ],
   "status" : "OK"
}

I can only get the Five Guys data if I add some information related to the establishment in the query. For example:

https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=1628+Shore+Pkwy+Brooklyn+NY+1214+five&inputtype=textquery&fields=name,formatted_address,place_id,geometry/location,types&key=XXXXX

gives me what I want:


{
   "candidates" : [
      {
         "formatted_address" : "1628 Shore Pkwy, Brooklyn, NY 11214, United States",
         "geometry" : {
            "location" : {
               "lat" : 40.5952363,
               "lng" : -74.0002255
            }
         },
         "name" : "Five Guys",
         "place_id" : "ChIJ3XR8AlNbwokRafmD4huXlzQ",
         "types" : [
            "meal_takeaway",
            "restaurant",
            "food",
            "point_of_interest",
            "establishment"
         ]
      }
   ],
   "status" : "OK"
}

The problem is I won't have related information for the queries I want to do, only the address. How to work around that?

1 Answers

If you replace "+five" with "+name", it seems to work in the general case.

https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=1628+Shore+Pkwy+Brooklyn+NY+1214+name&inputtype=textquery&fields=name,formatted_address,place_id,geometry/location,types&key=XXXXX

Related