3
votes

I would like to search places around a specific location. I've tried to use the autocomplete search api https://developers.google.com/places/web-service/autocomplete however it's also returning results that aren't inside my search radius. Besides the response does not include the place location so I cannot manually remove places that are out of the radius.

I've also tried to use nearbysearch (https://maps.googleapis.com/maps/api/place/nearbysearch/output?parameters ) and textsearch (https://maps.googleapis.com/maps/api/place/textsearch/output?parameters) but they don't return any result when the query parameter has a partial name (example: searching with query "wa" instead of "walmart").

Is there any solution to find places around a location in ONE request to the place api ?

1
I might have an idea.. But.. Wait.. No. No it's not gonna work. Sorry buddy - Jack'
Can you please show your code? You should be able to use the bounds property to do what you want. - Brian
@Brian maps.googleapis.com/maps/api/place/autocomplete/… for the the autocomplete. What is the bounds property ? Can't find it in the doc - Stéphane
Sorry, I was referring to the JavaScript API, not the Web Service API. For the WS API, did you try the strictbounds parameter? - Brian
@Brian I was on the french version of the doc but this parameter is not documented anywhere... I switched to the english version and there it is ! Thanks i'm gonna try it ! - Stéphane

1 Answers

2
votes

By default, the Google Places API will prefer showing results within your search radius, but can return results outside the radius. The API also supports a parameter called strictbounds that will limit the results to your search radius.

More information can be found here.