Find Place requests Returns Only One Result
Asked Answered
L

1

14

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.

Liaotung answered 11/9, 2018 at 10:19 Comment(2)
I have the same problem. Did you figure it out?Hypophysis
Unfortunately it seems like a limitation of that specific API endpoint...Liaotung
P
8

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

Plover answered 31/3, 2019 at 22:33 Comment(1)
Google seems inconsistent with textsearch everything was working good and suddenly started returning one result. When in capital letter only one result when lower case worked. issuetracker.google.com/issues/258933675Crude

© 2022 - 2024 — McMap. All rights reserved.