how to sort results in google places api
-
14-11-2019 - |
Question
I want to sort results fetched via google places api based on increasing distance from "location" (a pair of lat, lng). There is no documentation on their official page. http://code.google.com/apis/maps/documentation/places/#PlaceSearchRequests
It just says:
Each element of the results array contains a single result from the specified area (location and radius), ordered by prominence. The ordering of results can be influenced by check-in activity within your application - Places with many recent check-ins may figure more prominently in your application's results. The result may also contain attribution information which must be displayed to the user.
However they didnt mention anything about their prominence meter algorithm.
Solution
The Google Places API does not currently support this feature.
There is a feature request for this in the Places API issue tracker here: http://code.google.com/p/gmaps-api-issues/issues/detail?id=3322
Please click the 'star' icon to be notified of future changes, and to let us know you are interested in seeing it resolved.
Cheers
Chris
OTHER TIPS
This has been added to the API, please use the 'rankby=distance' instead of 'radius' in your Place Search Request as described in the documentation here: https://developers.google.com/maps/documentation/places/#PlaceSearchRequests