如何写“查找最近的”算法?例如,通过地址/邮政编码/“我的位置”的商店/分店定位器
向用户显示他/她所在区域(或通过邮政编码/地址)的所有“事物”列表
我的需求很简单,并且通常在当今任何基于位置的应用程序中实现,使用 Google Maps API(尤其是新的“商店定位器库")听起来是最安全的选择,但如果我想自己开发一些东西,有“标准”的方法吗?有哪些选择?雅虎地理位置 API(和反向查找)? (Google Maps API 要求使用他们的地图,而不仅仅是 API)购买邮政编码文件吗?其他第三方服务?在线的?离线?秘密是什么?
My need is simple and commonly implemented in any location based app today, display to a user a list of all "things" in his/her area (or by a zip code / address)
Using Google Maps API (especially the new "store locator library") sounds like the safest bet, but if I would like to develop something on my own, is there a "standard" way to do so? what are the options? Yahoo geo-location API (and reverse lookup)? (Google Maps API require to use their map, not just API) purchace ZIP code files? other 3rd party services? online? offline? what is the secret?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
唔。邮政编码可以通过多种方式处理,这有助于了解其工作原理的一般背景:http: //en.wikipedia.org/wiki/ZIP_code
我会购买带有 GPS 坐标的 USPS 数据库,并从那里开始工作。一个简单的 SELECT SQL 查询,在计算向量的大小时,带有 LIMIT 或 TOP 10(或者您想要的任何搜索结果),应该可以在这里工作。
已经有一段时间了,但是向量计算的算法相当简单,应该很容易用 SQL 实现: http://www.netcomuk.co.uk/~jenolive/vect5.html
Hmm. Zip codes can be handled a number of ways, and it helps to get a general background on how they work: http://en.wikipedia.org/wiki/ZIP_code
I'd purchase a USPS database with GPS coordinates, and work from there. A simple SELECT SQL query, with a LIMIT or TOP 10 (or however many search results you'd like) when calculating the magnitude of the vector should work here.
It's been a while, but the algorithm for vector calculation is fairly simple, and should be easy to implemented in SQL: http://www.netcomuk.co.uk/~jenolive/vect5.html