简体   繁体   中英

Google Maps API nearbysearch not returning the nearest locations

I am working on an android app and want the checkin feature in my application. I want to get all the locations nearby my current location.

I have used the Google Places API and sending a request on the below url for getting the results.

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=28.4573585,77.0332349&radius=2000&key=AIzaSyByyUldmVJqsrB_yYGlVzWF92des4DbsZ0

I want all the results inside 2 Km distance from my current location.

I am getting some nearby locations but not getting the nearest locations which are 100 meters or 200 meters away from the current location.

How can I get them, do I need to pass some extra parameter in the above nearbysearch request.

Also, I need to order the places according to the distance. nearest places should come first in the results.

Please help me if anyone know how to achieve this.

Thanks a lot in advanced.

By default, each nearby search returns up to 20 locations per query. However, accessing additional results as many as 60 locations, can be done by passing the value of the next_page_token to the pagetoken parameter of a new search as shown in Accessing Additional Results .

Additionally, Nearby Search Requests can be refined by supplying keywords. You can put ordering on the results according to the distance by specifying rankby=distance in your search request and adding one or more of keyword, name, or type as required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM