Reputation: 597
I have to get the place id of a city using the Google Maps and Google Places SDK-s. I know the GMSPlacesClient
contains methods for accessing a location using the place id but not vice versa.
What I would like to achieve is to send a city's name/zip code/ coordinates or something like that, and get back as a result, the place id identifying that city.
I've been studying the documentation for the GMSPlacesClient
at this link and experimenting with the methods for hours, however I can't seem to achieve this, however basic this capability is.
Let me know if you need me to provide some further info on this.
Upvotes: 1
Views: 896
Reputation: 596
You should be able to get the placeID by accessing the .placeID property on a GMSPlace.
https://developers.google.com/places/ios-sdk/reference/interface_g_m_s_place
You will need to use this class to get the location using the autocomplete...
https://developers.google.com/places/ios-sdk/reference/interface_g_m_s_autocomplete_prediction
You will need to filter your search results using an instance of — GMSAutocompleteFilter()
let filter = GMSAutocompleteFilter()
filter.type = .city
Upvotes: 3