0

i am about to use Google Places api in my project but i have a problem. It's ok when searching city and all cities have unique id in search results as expected and i can save my entries to my database with the city id from google places api.

But when searching with country name, google finds and returns also unique id. So how can i list my entries with unique city ids belonging to that country when a country searched. If all cities and countries were kept in my db, that was no problem but i can see Airbnb also uses Places Api and you can search country and they list entries with cities belonging to that country.

Kara
  • 6,115
  • 16
  • 50
  • 57
Melih
  • 323
  • 3
  • 11
  • Hey Melih, I was wondering whther you have figured this out yet. I am running into a similar issue. Thanks! – Joni Nov 27 '13 at 19:28
  • 1
    Hi @Joni, yea i'm totally out of this problem. Let me tell you. I give up planning to save city name, city guid whatever as a string or id. Just save langitude and longitude coordinates of the place. All you have to do is to save just these 2 values. When you search place in site, you get boundary variables of google map [check it](http://stackoverflow.com/questions/6910847/get-boundaries-longitude-and-latitude-from-current-zoom-google-maps) and get the results between these coordinates. Map boundaries has 4 variable. Southwest langitude, southwest longitude, northeast langitude and northeast – Melih Nov 30 '13 at 23:28
  • 1
    According to these 4 variables, you can search your db and get the results between these boundary variables. I investigated Airbnb and now i implemented my site due to these fact. I hope it's useful for you – Melih Nov 30 '13 at 23:53

0 Answers0