mirror of https://gitee.com/bigwinds/arangodb
revert broken fix for WITHIN_RECTANGLE, restore the old (non-working) behavior (#4038)
This commit is contained in:
parent
a15f6c6f05
commit
3f9918a163
|
@ -61,8 +61,6 @@ devel
|
|||
vertex which is perfectly valid, but it may be a n issue on the data model, so users
|
||||
can directly see it on the query now and do not "by accident" have to check the LOG output.
|
||||
|
||||
* potential fix for issue #3562: Document WITHIN_RECTANGLE not found
|
||||
|
||||
* introduce `enforceReplicationFactor` attribute for creating collections:
|
||||
this optional parameter controls if the coordinator should bail out during collection
|
||||
creation if there are not enough DBServers available for the desired `replicationFactor`.
|
||||
|
|
|
@ -555,26 +555,13 @@ SimpleQueryWithinRectangle.prototype.execute = function () {
|
|||
* 1000; // kilometers to meters
|
||||
};
|
||||
|
||||
// need only half of the diameter as the radius
|
||||
// divide by just 1.999 to allow for some rounding errors
|
||||
var radius = distanceMeters(this._latitude1, this._longitude1, this._latitude2, this._longitude2) / 1.999;
|
||||
var diameter = distanceMeters(this._latitude1, this._longitude1, this._latitude2, this._longitude2);
|
||||
var midpoint = [
|
||||
this._latitude1 + (this._latitude2 - this._latitude1) * 0.5,
|
||||
this._longitude1 + (this._longitude2 - this._longitude1) * 0.5
|
||||
];
|
||||
|
||||
var midpoint = (function(latitude1, longitude1, latitude2, longitude2) {
|
||||
latitude1 = latitude1 * Math.PI / 180;
|
||||
latitude2 = latitude2 * Math.PI / 180;
|
||||
longitude1 = longitude1 * Math.PI / 180;
|
||||
longitude2 = longitude2 * Math.PI / 180;
|
||||
var Bx = Math.cos(latitude2) * Math.cos(longitude2 - longitude1);
|
||||
var By = Math.cos(latitude2) * Math.sin(longitude2 - longitude1);
|
||||
|
||||
return [
|
||||
Math.atan2(Math.sin(latitude1) + Math.sin(latitude2),
|
||||
Math.sqrt((Math.cos(latitude1) + Bx) * (Math.cos(latitude1) + Bx) + By * By)) * 180 / Math.PI,
|
||||
(((longitude1 + Math.atan2(By, Math.cos(latitude1) + Bx)) * 180 / Math.PI) + 540) % 360 - 180
|
||||
];
|
||||
})(this._latitude1, this._longitude1, this._latitude2, this._longitude2);
|
||||
|
||||
result = this._collection.within(midpoint[0], midpoint[1], radius).toArray();
|
||||
result = this._collection.within(midpoint[0], midpoint[1], diameter).toArray();
|
||||
|
||||
var idx = this._collection.index(this._index);
|
||||
var latLower, latUpper, lonLower, lonUpper;
|
||||
|
|
Loading…
Reference in New Issue