Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find Place requests Returns Only One Result

I'm using the Google Places API endpoint "findplacefromtext" and tried a search similar to the example.

https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=mongolian%20grill&inputtype=textquery&fields=photos,formatted_address,name,opening_hours,rating&locationbias=circle:[email protected],-122.2226413&key=YOUR_API_KEY

However, when you use this it only ever returns one result. There is a cafe near me that's called "Cream" but when you pass that as the "input" parameter it returns shops that have a category of "Ice Cream". I thought it should only search the name of the business.... If I can't find the place by name does it search the category type as a fall back? When I execute the same search in Google Maps it returns the same data but I get multiple results and I can see the place I am trying to retrieve 3rd on the search result list.

Is it possible to make it return more than one result? The documentation doesn't mention anything about this.

like image 653
Andrew Schultz Avatar asked Sep 11 '18 10:09

Andrew Schultz


People also ask

How can I get more than 20 results on Google Places API?

The documentation says that the Places API returns up to 20 results. It does not indicate that there is any way to change that limit. So, the short answer seems to be: You can't. Of course, you might be able to sort of fake it by doing queries for several locations, and then merging/de-duplicating the results.

How do I get more than 5 reviews on Google Places API?

In order to have access to more than 5 reviews with the Google API you have to purchase Premium data Access from Google. That premium plan will grant you access to all sorts of additional data points you have to shell out a pretty penny.

What is Google Places API?

The Places API and the client libraries are for use in server applications. If you're building a client-side application, take a look at the Places SDK for Android, the Places SDK for iOS, and the Places Library, Maps JavaScript API. The Places API is a service that returns information about places using HTTP requests.


1 Answers

I believe what you need is the Text Search request. The Find Place request is meant for exact addresses.

The Google Places API Text Search Service is a web service that returns information about a set of places based on a string — for example "pizza in New York" or "shoe stores near Ottawa" or "123 Main Street". The service responds with a list of places matching the text string and any location bias that has been set.

The service is especially useful for making ambiguous address queries in an automated system, and non-address components of the string may match businesses as well as addresses. Examples of ambiguous address queries are incomplete addresses, poorly formatted addresses, or a request that includes non-address components such as business names.

Taken from https://developers.google.com/maps/documentation/places/web-service/search#TextSearchRequests

like image 189
luizfls Avatar answered Sep 28 '22 05:09

luizfls