Answer the question
In order to leave comments, you need to log in
How do they work with cities based on the google API?
Hello!
Show how social networks work, like dating apps or similar apps, when the user indicates where he lives.
1. The user can specify the country
2. The user can specify the country and region
3. The country, region and city
All this is written in one field, sent to the server, the server receives a more suitable place for google api based on the entered data, and then what?
The user selected "Russia, Moscow region, Moscow"...
How then to search for users in the same location? More precisely, rather, the question is how to store this data? Is it really in text format on the server and then when the user searches for a friend in the same city - he uses the same form, writes "Moscow", Google suggests choosing "Russia, Moscow Region, Moscow", the user selects this option and the server searches in the database matches for the string "Russia, Moscow region, Moscow"?
Why is this question worth it ... Because there is no binding to some kind of ID. those. even if the server, each user input, parses the given Google result, saves it in the database, and then checks "Do we already have the city of Moscow in the Moscow region in Russia in the database?" the fact that Google api gave exactly that city of Moscow?...
Answer the question
In order to leave comments, you need to log in
Google has a lot of APIs for things like Places Autocomplete API, Place Details API, Geocoding API, etc. You can get both the coordinates of the city and its Place ID to organize the search, including - look for the locality type in the address_components array of the response. Make a project on GCP, understand the example from the documentation, there free limits are quite generous.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question