Start a new topic

can _geoloc return the distance?


I am using Android Kinvey and my collection has a field _geoloc that for querying people around me. Below are the code to query

Query q2 = new Query();

q2.nearSphere("_geoloc", location.getLatitude(), location.getLongitude(), 50);

AsyncAppData findNearByPeople = mKinveyClient().appData("userdata", UserData.class);

findNearByPeople.get(q2, new KinveyListCallback() {


public void onSuccess(UserData[] result) {



public void onFailure(Throwable error) {



How does kinvey or will kinvey return the distance as I need to sort my result by distance.

Appreciate any help please. Thanks !


Mark Thien

Good morning Mark,

This is not something that we presently support as nearsphere is actually a feature of MongoDB and not of the kinvey platform. You can read more about the implementation / limitations of MongoDB's nearsphere over here:

Some people who have run into issues have opted to use within instead ( , which again, has it's own set of issues to work through.

Hi Damien,

Thanks a lot for your answer. Do you recommend any other api service that can return distance ?



You can do it right within mongo, it's just not the most pretty stuff ever...

Login or Signup to post a comment