diff options
author | antirez <antirez@gmail.com> | 2015-06-24 10:42:16 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2015-06-24 10:42:16 +0200 |
commit | 55c4a365d74c5218a9303e31f1f7b67c424c9c2c (patch) | |
tree | fe35b97a00e65a95ac05ce4d16149990ab2a823f /src/redis-trib.rb | |
parent | cf89a19f162ce0550b1c3cfbaf11a64659856ded (diff) | |
download | redis-55c4a365d74c5218a9303e31f1f7b67c424c9c2c.tar.gz |
Geo: Fix geohashEstimateStepsByRadius() step underestimation.
The returned step was in some case not enough towards normal
coordinates (for example when our search position was was already near the
margin of the central area, and we had to match, using the east or west
neighbor, a very far point). Example:
geoadd points 67.575457940146066 -62.001317572780565 far
geoadd points 66.685439060295664 -58.925040587282297 center
georadius points 66.685439060295664 -58.925040587282297 200 km
In the above case the code failed to find a match (happens at smaller
latitudes too) even if far and center are at less than 200km.
Another fix introduced by this commit is a progressively larger area
towards the poles, since meridians are a lot less far away, so we need
to compensate for this.
The current implementation works comparably to the Tcl brute-force
stress tester implemented in the fuzzy test in the geo.tcl unit for
latitudes between -70 and 70, and is pretty accurate over +/-80 too,
with sporadic false negatives.
A more mathematically clean implementation is possible by computing the
meridian distance at the specified latitude and computing the step
according to it.
Diffstat (limited to 'src/redis-trib.rb')
0 files changed, 0 insertions, 0 deletions