DistanceTo () the return distance is not in meters!

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.

+2
source share
1 answer

distanceTo() , . , (0,0) .

0

Source: https://habr.com/ru/post/1772456/


All Articles