I am implementing an application to find the nearest local locations from a gps coordinate database.
I use the Location class function distanceTo()to calculate the distance between two locations of the current and one of the database.
currentloc.setLatitude(loc.getLatitude());
currentloc.setLongitude(loc.getLongitude());
dbcurrent.setLatitude(C.getDouble(latindex));
dbcurrent.setLongitude(C.getDouble(lonindex));
distance = currentloc.distanceTo(dbcurrent);
this work is beautiful, and I can use this distance to calculate the proximity in the rest of my application, but the distance that it itself is not visible in meters, I get a result, for example, 4134801.4. I am sure that the distance is 3200 meters in this case.
Is there an explanation or solution to this problem.
Thank you all.
source
share