Hi guys,
I have a content type (called Problems) that has a GeoPoint field called Location (what a surprise). I would like to filter Problems in radius from my current position.
For this purpose I try using Filter within a circle based on documentation. This is my filter:
{ "Location": { "$within": { "$centerSphere": { "center": { "latitude": 42.68873679844848, "longitude": 23.321410417556763 }, "radiusInKilometers": 10 } } } }
So, I set the center to { "latitude": 42.68873679844848, "longitude": 23.321410417556763 } and radius in kilometers to 10. The response contains single element (P1) with Location: { "longitude": 23.30376148223877, "latitude": 42.66969657424687}, but in the database I have another one (P2) with Location: { "longitude": 23.32123875617981, "latitude":42.686445812676766 }. If you check the coordinates on the map you can easily see that P2 is closer to the center than P1.
Any ideas?