开发者

Best way to implement users location that allows me to see what users live roughly in the same area

A key part of my current project is users having the ability to see what other users live near to them. What is the best way to implement this?

I would just ask for country, state and city but because this will be international I can't have a fixed drop down list of states/administrative regions for each country, so if users spell the name of their state differently this will hinder my ability to detect that users live in the same state.

Say for example we have an t开发者_如何学JAVAhe Swiss canton "St. Gallen". Some user will spell that as "Saint Gallen", others as "St Gallen" and so on. Which is obviously problematic.

Could I just ask for the zip code and use that? I've found some zipcode tools online but I'm suspecting they don't work very well. Has anyone used them?

Thanks for your asnwers.


Shouldn't you base your query on geographical data rather than administration one? I mean instead of comparing cities/zip codes just find people within, let's say, 5 km from current user location. And if you let every user to choose his/her location on the map, this will be as simple as choosing it from a series of drop-down lists or entering a ZIP code. Also there is an emerging geolocation HTML feature.

Querying such an information is different story thou. You'll probably gonna have to use GIS capabilities of your database: MySQL, PostgreSQL, Oracle and others.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜