Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google place API autocomplete search with radius as a strict filter

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 ?

like image 263
Stéphane Avatar asked Sep 05 '25 03:09

Stéphane


1 Answers

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.

like image 66
Brian Avatar answered Sep 08 '25 00:09

Brian