如何进行基于位置的搜索
我需要开发一种解决方案,使用户能够根据城市和州进行搜索。 用户应该能够请求搜索结果不仅包括该城市和州的匹配项,还包括 25、50、100 英里半径内的匹配项。 我看到招聘网站做这种事情。 这是如何完成的?是否有供应商为其提供开放 API?
谢谢
I need to develop a solution that will provide the ability for a user to search based on a city and state. The user should have the ability to request that the search results include not just matches for that city and state, but also include matches in a 25, 50, 100 mile radius. I see that job sites do this type of thing. How is this done and are there vendors that provide open API's for it?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看来您正在寻找的是一个 GIS(地理信息系统),其中每条(或某些)信息都与其地理位置相关联。 此类系统允许对这些地理位置执行空间搜索,例如。 “给我提供距此位置 5 英里半径范围内销售特定产品的所有商店”(也可以结合空间搜索和传统搜索)。
现在您可以使用一些技术示例:
It seems that what you're looking for is a GIS (Geographical Information System) in which each (or some) piece of information is linked to its geographical location. Such sistems allow to perform spatial searches on those geographical location, eg. "give me all stores in a 5 mile radious from this position which sells a specific product" (combining spatial and traditional searches is also possible).
Now some examples of technologies you can use:
您需要从城市、州和邮政编码及其相应纬度和经度的数据库开始。 这里有一个链接,您可以在该网站上免费下载此类数据库。
接下来,您需要一种算法来查找哪些城市/邮政编码位于用户输入的城市/邮政编码的 X 英里半径范围内。 这是另一个链接,应该解释如何执行此操作。
You'll want to start with a database of cities, states and zip codes with their corresponding latitude and longitude. Here's a link to a site where you can download such a database for free.
Next you'll need an algorithm to find which cities/zip codes are within an X mile radius of the city/zip the person entered. Here's another link that should explain how to do that.
您可能想查看GeoNames。
我为 GeoNames 编写了一个 .NET WCF 客户端,可在此处获取。
You might wanna have a look at GeoNames.
I have written a .NET WCF client for GeoNames, available here.