如何获得直线距离之间的两个位置中的Andr​​oid?

编程入门 行业动态 更新时间:2024-10-21 14:22:18
本文介绍了如何获得直线距离之间的两个位置中的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

首先阅读问题仔细...

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

更多推荐

如何获得直线距离之间的两个位置中的Andr​​oid?

本文发布于:2023-11-12 20:23:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582449.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:直线   如何获得   距离   位置   两个

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!