码迷,mamicode.com
首页 > 其他好文 > 详细

附近的人,附近的卖家(geohash+前缀树)

时间:2016-09-22 08:49:18      阅读:424      评论:0      收藏:0      [点我收藏+]

标签:

一、经纬度距离换算

a)在纬度相等的情况下:

 经度每隔0.00001度,距离相差约1米;

 每隔0.0001度,距离相差约10米;

 每隔0.001度,距离相差约100米;

 每隔0.01度,距离相差约1000米;

 每隔0.1度,距离相差约10000米。

 b)在经度相等的情况下:

 纬度每隔0.00001度,距离相差约1.1米;

 每隔0.0001度,距离相差约11米;

 每隔0.001度,距离相差约111米;

 每隔0.01度,距离相差约1113米;

 每隔0.1度,距离相差约11132米。

二、Geohash距离换算(使用base32编码)

如果geohash的位数是9位数的时候,大概为附近2米

下表摘自维基百科:http://en.wikipedia.org/wiki/Geohash

geohash length
lat bits
lng bits
lat error
lng error
km error
1 2 3 ±23 ±23 ±2500
2 5 5 ± 2.8 ± 5.6 ±630
3 7 8 ± 0.70 ± 0.7 ±78
4 10 10 ± 0.087 ± 0.18 ±20
5 12 13 ± 0.022 ± 0.022 ±2.4
6 15 15 ± 0.0027 ± 0.0055 ±0.61
7 17 18 ±0.00068 ±0.00068 ±0.076
8 20 20 ±0.000085 ±0.00017 ±0.019

 

 

附近的人,附近的卖家(geohash+前缀树)

标签:

原文地址:http://www.cnblogs.com/zlcxbb/p/5894851.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
分享档案
周排行
mamicode.com排行更多图片
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!