Save User Location

1

I'm trying to save the user's location in a database, to later generate user reports by country, state, and region.

I initially downloaded databases that contained the names of all cities in the world, in multiple languages, but this left the app keeping a horror. Without saying it's impractical to keep the database up to date.

I thought of starting with an API like Google, but when users ask for a location in the API, the results come in the language of the user. So it is possible that I have at base New York, New York and other versions, which complicates the generation of reports.

I'd like some help in modeling the data so you can save and search, without having to list all the names of the world. I'm using Django / PostgreSQL.

    
asked by anonymous 02.09.2017 / 15:33

1 answer

0

A tricky theme, the only solution I see is to use Google's api to get the location (no matter which language) and save the only thing that is common to any language: coordinates! So when the guy types in New York / New York / NY you'll get the coordinates and save. The only caution to take is to check if Google always returns the same coordinate to refer to the same city, but I believe it returns.

Just a suggestion, good luck!

    
04.09.2017 / 22:28