问题描述
我正在开发一个必须显示最短路径的应用程序.我使用的是Google Direction API,但在相同的目的地和出行方式下,结果却与Google Maps应用不同.
I am working on an app in which I have to show shortest route. I am using Google Direction API but the result is different from Google Maps app for same destination and travel mode.
由于替代方法是正确的,因此我已经在使用可用路由中的最短路由(响应).
Since alternative is true I am already using shortest route from available routes (response).
注意:-当我在地图应用中输入起点和终点的纬度时,它会显示相同的结果.仅当我们输入起点和终点时,它才会显示不同的结果.
Note : - When I enter lat lng of origin and destination in the map app it shows same result. It shows different result only when we type the origin and destination.
推荐答案
我找到了解决方案.当我放置目标place_id而不是lat lng时,它显示的结果与google map应用程序相同.我不知道它是如何工作的.这样的变化甚至在开发人员文档中都没有提及.
I got the solution. When I put destination place_id instead of lat lng it is showing same result as google map app. I don't know how it is working. Such variation not even mentioned in developer docs.
这篇关于Google Direction API和Google Maps App显示针对同一目的地的不同路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!