Limit user in google place api to 5 km area of ​​this location lat lng

I want to set the google place auto auto-fill text box, but I want the user to see only those places that are below 5 km at a given location. I am not talking about a near search. I tried google map API but it does not display correctly. I used this API.

+6
source share
3 answers

You can use LatLng Borders to limit the use of places.

There is a workaround for this, but involves a little math calculation

Current Location + Distance North = New LatLngBounds;

currentLocation + south Direction (maybe you need to convert km to radians) = new SouthBounds;

and add frames to the widget

myPlaceAutoComplete.setBounds(northBounds,southBounds) 
0
source

Your problem is probably due to the fact that your radius is 500. Try changing it to 5000.

puts documentation autocomplete webservice says radius should be in meters.

TL; DR

Try this link

0
source

All Articles