我正在开发一个谷歌地图应用程序。我已经调用了地图活动类。在谷歌地图上我已经显示了当前位置以及多个标记。现在我面临的问题是计算2个坐标之间的距离价值....有没有人实现过它?对我来说这将是一个很大的帮助.....在此先感谢
答案 0 :(得分:3)
例如,当我搜索look what turned up as the very first Google result
时,"android calculate map distance between points"代码段:
double distance;
Location locationA = new Location("point A");
locationA.setLatitude(latA);
locationA.setLongitude(lngA);
Location locationB = new Location("point B");
locationB.setLatitude(latB);
LocationB.setLongitude(lngB);
distance = locationA.distanceTo(locationB);