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.
See this - http://developer.mapquest.com/ 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 - http://code.google.com/apis/maps/ 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 - http://stackoverflow.com/questions/1631710/strategies-for-large-volume-of-location-geocoding
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: http://www.geodatasource.com/ ).
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.
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.
Check out http://weather.com.
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 http://maxmind.com. Don't use the Google IP stuff -- it barely works.
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.:
However if you need geo-location that is more pin-point than a city this might not be as robust as you want.
Springfield, Sangamon, IL, USA
Springfield, Hampden, MA, USA
Springfield, Lane, OR, USA
Springfield, Clark, OH, USA
Springfield, Fairfax, VA, USA