distanceTo() return distance not in meters !
I am implementing an application to search for nearest local venues from a gps coordinates database.
i am using the Location class distanceTo()
function to calculate distance between two location the current one and the one from the database.
currentloc.setLati开发者_运维知识库tude(loc.getLatitude());
currentloc.setLongitude(loc.getLongitude());
dbcurrent.setLatitude(C.getDouble(latindex));
dbcurrent.setLongitude(C.getDouble(lonindex));
distance = currentloc.distanceTo(dbcurrent);
this work fine and i am able to use this distance to calculate proximity in the rest of my app, but the distance it self is not apparently in meters i am getting result like 4134801.4 i am sure that the distance is 3200meters in this case.
Is there any explanation or solution for this issue.
thank you all.
distanceTo()
work correctly, it is your fault.
Such high distances can happen if your provide (0,0) as other point.
精彩评论