[SERVER-16652] wrong distance calcul when GeoNear used with aggregate Created: 23/Dec/14 Updated: 10/Jan/15 Resolved: 05/Jan/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework, Geo |
| Affects Version/s: | 2.6.6 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | guipulsar | Assignee: | Siyuan Zhou |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||||||||||||||||||||
| Operating System: | ALL | |||||||||||||||||||||||||||||
| Steps To Reproduce: | this distance query output without aggregation is correct :
This one with aggregation is not :
|
|||||||||||||||||||||||||||||
| Participants: | ||||||||||||||||||||||||||||||
| Description |
|
wrong distance calcul when GeoNear used with aggregate . The same Geonear query with same distanceMultiplier When query A return 1.59861657499673, Divion by 1000 isnot indicate in manual if i didn't miss something.. |
| Comments |
| Comment by guipulsar [ 05/Jan/15 ] | ||||||||||||||||||||||||||||||
|
ok thanks for ur clarifications | ||||||||||||||||||||||||||||||
| Comment by Siyuan Zhou [ 02/Jan/15 ] | ||||||||||||||||||||||||||||||
|
As I mentioned before, the distance and maxDistance will be in meters if the coordinate is given in GeoJSON format, as in the following example, because GeoJSON implies the computation happens on the globe. distanceMultiplier only affects the distance in output. For instance, [0, 1] (longitude, latitude) and [0, 0] are about 111 km away, given by this website. The following example with 2.6.6 gives the correct result in kilometers.
I hope this answers your question. I am closing this ticket as "Work as Designed" as the distance is calculated correctly. | ||||||||||||||||||||||||||||||
| Comment by guipulsar [ 30/Dec/14 ] | ||||||||||||||||||||||||||||||
|
At least the doc is totaly unclear... { , }, | ||||||||||||||||||||||||||||||
| Comment by guipulsar [ 30/Dec/14 ] | ||||||||||||||||||||||||||||||
|
so the outputt show { "calculated" : 10196136.37698665 }, instead it should be { "calculated" : 1.019613637698665 } | ||||||||||||||||||||||||||||||
| Comment by guipulsar [ 30/Dec/14 ] | ||||||||||||||||||||||||||||||
|
i know, in this example for unit in km , the calculation is wrong , this coordinates corespond to paris ,my code is corect right ?! { , }, , { $project : { _id : 0 , ville : 1 , code_postal:1 , "dist.calculated":1 }} ] ) the output is : }, | ||||||||||||||||||||||||||||||
| Comment by Siyuan Zhou [ 30/Dec/14 ] | ||||||||||||||||||||||||||||||
|
If the distance is given as legacy coordinate paris, the unit of distance will be radian. However, distance in GeoJSON format implies the unit is meter. In the documentation of geoNear command and $geoNear aggregation operator:
|