本文介绍了如何获得直线距离之间的两个位置中的Android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
首先阅读问题仔细...
First read Question carefully ...
我需要的直线距离 不走路,汽车,或等。
看看下面这给这一形象,
Take a look to this image which given below,
谷歌提供给我们距离车和驾驶。
Google provide us distance by car and driving.
但我不想要它,我想直线距离之间的两个位置(纬度 - 经度)
But I don't want it, I want straight distance between two location (latitude - longitude).
将显示为为红线。
注意:我不希望把红线在谷歌地图,只是想在单位的远程(英里,公里等)
NOTE : I don't want to put red line on Google map, just want the Distance in Units(mile,km,etc.)
推荐答案机器人
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);
MATHEMATICALY
a = distance in degrees //meterConversion = 1609; b = 90 - latitude of point 1 c = 90 - latitude of point 2 l = longitude of point 1 - longitude of point 2 Cos(a) = Cos(b)Cos(c) + Sin(b)Sin(c)Sin(l) d = circumference of Earth * a / 360 // circumference of Earth = 3958.7558657440545D km更多推荐
如何获得直线距离之间的两个位置中的Android?
发布评论