Geography in a social network


I want to make a global social network, in which users can search for nearby users.

What is the preferred way to allow users to easily specify where they are located?

Zip code would be accurate, but is US-only.

Lat/long would be accurate, but it is too difficult for mom and dad types.

Drop-down menu of continent, country, province, major city is simple, but perhaps not that accurate if someone lives somewhere remote or in between two major cities.

My question isn't how to convert an address to a lat/long.
My question is what is the most idiot-proof user interface to get a user's address within a few miles.

Your thoughts?

Profile Geography Social Network

asked Nov 12 '09 at 16:20
Joseph Turian
895 points

6 Answers


See this - Since you are starting up I guess it would be best that you don't develop such a thing in house and use 3rd party solutions. I think mapquest lets you do what you are trying to achieve. Also see the Google API - If you want to develop your own solution (which is good for a scalable platform), there is something called - Great circle distance See for more details -

answered Nov 13 '09 at 01:00
Arpit Tambi
1,050 points


Unless you are trying to connect next door neighbors, I would imagine City + Country should be sufficient... Make them select a country from a drop down and type the city or better yet, a single free-form auto-completing text field.

If the city is ambiguous/misspelled or you don't have it in your database, ask the user for clarification (e.g. which state, zip code or near which major city). You would need a decently large database of cities and their GPS coordinates but you can purchase this type of information (quick Google search: ).

answered Nov 12 '09 at 16:30
Oleg Barshay
2,091 points


Some good comments on this already. I'll add one more thing: I have worked on global financial systems before and I can tell you that the databases you can purchase (for example, the ISO location database, which lists country-territory/state-city-global_coordinates and at first seems ideal for your needs) are woefully incomplete.

Don't get me wrong, they are a great starting point, it's much better than having nothing. You'll just need to build expandability from the very beginning. Allow your users to build upon it, add a city that is not there, or add a neighborhood to a city (for example, NYC in the USA is the only place where people routinely specify where they are from within a city (the borough, such as Queens, Manhattan, etc...). You would do well to accommodate that, specially given that people from other places in the work do this more routinely (and each city subdivision or neighborhood is markedly different from the next, so people in, say, Mexico city really do care what part of Mexico city other people are from).

If your project is all about location and finding people based on it, it would pay off if you make your mechanism a accommodating as possible, so spend some really good time on this. Allow people to tell you as easily as possible where they are at, and allow people to add their location to your database as easily as possible.

answered Nov 12 '09 at 22:22
Gabriel Magana
3,103 points


Implement a global map mashup that allows users to navigate to their part of the globe and mark their exact location. Your application would then obtain the lat/long and store that in the backend, keeping all location data uniform.

It may also be beneficial to provide an alternative locating system, such as choosing a major city and country. It gives the user the option to choose the most familiar interface. Although, providing many ways to do the same task can be a bad design.

It is best to test all viable options and let your users tell you what they prefer.

answered Nov 12 '09 at 20:00
695 points
  • This sounds needlessly complicated, both from a user and programmer perspective. – Joseph Turian 14 years ago
  • Not hard, just find a programmer that knows what they are doing. In fact, most of the work work is done for you; just call APIs. Joseph, if think calling APIs and testing is needlessly complicated and you are unwilling to implement, then the kind of application you want to build will lack in features and usability. – Clint 14 years ago


Check out

You enter a free-form location and if it's ambiguous they present you with a short list of options.

You can also use the person's IP address to get an approximation. That would be bad if it were ALL you used, but for example you can use that to pin down the country so the rest of your city/region/zip search isn't presenting options from across the globe.

For a decent, free IP address -> location database, see Don't use the Google IP stuff -- it barely works.

answered Nov 13 '09 at 05:10
16,231 points


I quite like a simple autocomplete textbox.

After 2 characters, run a search and return the top 10-20 results... re-filtering on each additional character as typed.

Thus if I type "tor " I typically see "Toronto, Canada " in the results almost immediately.

And for cases where there are lots of dupes... just list them e.g.:

Springfield, Sangamon, IL, USA

Springfield, Hampden, MA, USA
Springfield, Lane, OR, USA
Springfield, Clark, OH, USA
Springfield, Fairfax, VA, USA
However if you need geo-location that is more pin-point than a city this might not be as robust as you want.
answered Nov 13 '09 at 12:35
310 points

Your Answer

  • Bold
  • Italic
  • • Bullets
  • 1. Numbers
  • Quote
Not the answer you're looking for? Ask your own question or browse other questions in these topics:

Profile Geography Social Network