Save user location

Asked

Viewed 162 times

1

I am trying to save the user’s location in a database, to subsequently generate reports on users by country, state and region.

Initially I downloaded bases that contained the name of all the cities of the world, in several languages, but this left the maintenance of the application a horror. Without saying that it is impractical to keep the base up to date.

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

I would like a help to shape the data in a way that I can store and research, without having to have a list of all the names in the world. I’m using Django/Postgresql.

1 answer

0

A complicated theme, the only solution I see is to use the Google Api to pick up the location (no matter what language) and save the one thing that is common to any language: coordinates! So when the guy types New York/New York/New York you’ll get the coordinates and save. The only precaution 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!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.