Gettting不同距离使用的谷歌地图和用户自定义函数当 [英] Gettting Different Distance When Using the Google Map and User defined Function

查看:140
本文介绍了Gettting不同距离使用的谷歌地图和用户自定义函数当的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

这篇关于Gettting不同距离使用的谷歌地图和用户自定义函数当的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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