Gettting不同距离使用的谷歌地图和用户自定义函数当自定义、函数、距离、不同

由网友(等待)分享简介:我希望得到两个纬度和经度米/公里之间的距离。所以,我现在用的是下面的功能。它给了我不同的结果比谷歌地图。I want to get the Distance between two latitude and longitude in meter / km . So i am using the below funct...

我希望得到两个纬度和经度米/公里之间的距离。所以,我现在用的是下面的功能。它给了我不同的结果比谷歌地图。

I want to get the Distance between two latitude and longitude in meter / km . So i am using the below function . It gives me the different result than the google Map.

你能不能帮我解决我的问题?我不明白这是什么问题?

Can you help me to solve my problem ? i dont understand What is the Problem ?

code

   float[] results = {0};

   android.location.Location.distanceBetween(lat1, lon1, lat2, lon2, results);

当前纬度= 23.012281666666663 当前经度= 72.51798333333333

目标纬度= 23.1120487 目标纬度= 72.5766759

它给出了这样的结果=在仪表12579.679,而在谷歌地图就给人这样的结果=17.9公里

我不明白为什么这两给出了不同的结果。

I do not understand why this two gives the different result.

推荐答案

此图解释了为什么你得到12.5和17.6公里

This diagram explains why you get 12.5 and 17.6 kms

要计算行驶距离(17.6公里),你需要使用的方向API

To calculate the driving distance (17.6 km) , you need to use the directions API

阅读全文

相关推荐

最新文章