计算在机器人2的纬度和经度点之间的距离 [英] Calculating the distance between two latitude and longitude points in android

查看:189
本文介绍了计算在机器人2的纬度和经度点之间的距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关的纬度和放大器之一;经度点我有它的数据库和放大器;另外一个我想使用手机的当前位置

For one of the latitude & longitude points i have it in database & another one i want to use current position of the mobile

哪一个,我应该要用到它们之间如下:

  • 在Android的位置提供
  • 在谷歌API
  • 在数学计算

注意 ::任何演示code样品将是有益的。

note:: Any demo code sample will be useful

推荐答案

或内置algorythm:

or the built in algorythm:

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) ;

这篇关于计算在机器人2的纬度和经度点之间的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆