简体   繁体   English

Android中行车方向模式下两点距离如何计算

[英]How To Calculate Distance Between Two Points in Driving Direction Mode in Android

everyone... I have something to ask about using a MapView in Android with Google Maps API..大家...关于在 Android 和 Google 地图 API 中使用 MapView 的问题,我有一些问题要问。

I've read about how to make a Geopoint or more and find a distance between 2 points..我已经阅读过如何制作一个或更多的地理点并找到两点之间的距离..

One thing that still makes me confuse is about calculating a distance between 2 points.仍然让我感到困惑的一件事是计算两点之间的距离。 I've tried and find the result but it's applied if the condition is when I want to make a straight line between those points.我已经尝试过找到结果,但如果条件是我想在这些点之间画一条直线,它就会被应用。 But, when I crosscheck with maps.google.com, the result (distance) is different with the same latitude and longitude of those points.但是,当我与 maps.google.com 进行交叉检查时,结果(距离)在这些点的经纬度相同时是不同的。 And I realize that its a kind of a Driving Direction..我意识到这是一种驾驶方向..

example of Google Map Web Google Map Web 示例

If you see the picture, it's not a straight line so of course the distance is different.如果你看图片,它不是一条直线,所以距离当然是不同的。 So how could I calculate this distance in Android in this case?那么在这种情况下,我如何计算 Android 中的这个距离呢? And please show me the code to make it...请告诉我制作它的代码......

Yes it will return you the straight line distance between two point.. you can use Google direction API for this...Here is the link for this.是的,它会返回你两点之间的直线距离。你可以使用谷歌方向 API 来做这个......这是这个链接。 http://code.google.com/apis/maps/documentation/directions/ http://code.google.com/apis/maps/documentation/directions/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM