React-native-google-places-autocomplete: Questions: How to get streets for specified city only

Created on 2 Mar 2020  路  3Comments  路  Source: FaridSafi/react-native-google-places-autocomplete

Hi there!
Just want to ask if you have an idea how to get street for specified city. I know, there is the way, but I cant figure out what options should I use. Any ideas?

question needs docs

Most helpful comment

You can do it like this by inputing the longitude and latitude of the city center and then setting the radius.

query={{ key: "YOUR_API_KEY", language: "en", // language of the results location: "44.786600, 20.448900", radius: "12000", //12 km components: "country:rs", strictbounds: true }}

All 3 comments

You can do it like this by inputing the longitude and latitude of the city center and then setting the radius.

query={{ key: "YOUR_API_KEY", language: "en", // language of the results location: "44.786600, 20.448900", radius: "12000", //12 km components: "country:rs", strictbounds: true }}

@VukovicIvan
Thanks a lot! You have saved my life!

That works well indeed to restrict the area to a radius. Just to add to the solution, if it doesn't get you the right results in the ios simulator you need to manually set it going to the simulator top bar menu, FEATURES -> LOCATION -> Custom Location and put your actual location(you can search it on google maps or whatever) since the default is None(which will make this library not to work at all for ios, you will get PERMISSION_DENIED unless you change that. The other problematic scenario would be that your Location is set but to another latitude/longitud so the radius condition may not be met.

Was this page helpful?
0 / 5 - 0 ratings