evenro evenro - 1 month ago 5
iOS Question

Get a list of places near a specific point (NOT near current place)

I want to get a list of places near an area my user looks at on a map (within an iOS app).
I am using Google API:

var placesClient: GMSPlacesClient? = GMSPlacesClient.shared()


I could have not figure out an interface that provides what I want..

placesClient?.currentPlace


does not provide the required results, since its results are only near the current location.

placesClient?.autocompleteQuery


would have been a great workaround if it allowed using an empty query, which it does not....

Any ideas on how to get places near a specific point / region I supply?

Thanks.

Answer

It appears Google has a web service that can be used for that.

The web service API is available here: https://developers.google.com/places/web-service/

The API asks for location, radius, and key - exactly what I needed.

I posted a question (and an answer for it later) with an example of how to call it (please make sure you implement the solution, and not just copy-paste the code): Google Places API web service using swift returns error 303