Google 地图方向 API 服务器端和嵌入式 return 不同的数据
Google Maps directions API server-side & embedded return different data
当我使用 Google 地图方向 API(服务器端)时,距离和持续时间几乎总是与嵌入式 (iframe) 地图告诉我的不同。
我用内嵌版给客户看,我用API版计算打车价格。因此,我有必要从这两种服务中获得相同的距离和持续时间。
我正在使用以下原始地址: Straße des 17. Juni, Berlin, Germany
我正在使用以下目的地地址: 荷兰阿姆斯特丹史基浦机场
使用上面的路由,这是输出:
嵌入式 (iframe):6 小时 31 分钟 - 661 公里
API(服务器端):6 小时 3 分钟 - 662km
方向 API:https://developers.google.com/maps/documentation/directions/
方向嵌入:https://developers.google.com/maps/documentation/embed/start
希望有人能帮助我。
不同距离:
嵌入式将您的目的地更改为 "Schiphol Amsterdam Airport, Evert van de Beekstraat 202, 1118 CP Schiphol, Netherlands",而 API 呼叫离开时与您输入的完全一样。结果坐标不同
API call with slightly modified destination
不同时间:
看起来嵌入考虑了交通状况,departure_time 而 API 调用没有。您使用的是 API 密钥吗?
For driving directions: Google Maps API for Work customers can specify the departure_time to receive trip duration considering current traffic conditions
当我使用 Google 地图方向 API(服务器端)时,距离和持续时间几乎总是与嵌入式 (iframe) 地图告诉我的不同。
我用内嵌版给客户看,我用API版计算打车价格。因此,我有必要从这两种服务中获得相同的距离和持续时间。
我正在使用以下原始地址: Straße des 17. Juni, Berlin, Germany
我正在使用以下目的地地址: 荷兰阿姆斯特丹史基浦机场
使用上面的路由,这是输出:
嵌入式 (iframe):6 小时 31 分钟 - 661 公里
API(服务器端):6 小时 3 分钟 - 662km
方向 API:https://developers.google.com/maps/documentation/directions/
方向嵌入:https://developers.google.com/maps/documentation/embed/start
希望有人能帮助我。
不同距离:
嵌入式将您的目的地更改为 "Schiphol Amsterdam Airport, Evert van de Beekstraat 202, 1118 CP Schiphol, Netherlands",而 API 呼叫离开时与您输入的完全一样。结果坐标不同
API call with slightly modified destination
不同时间:
看起来嵌入考虑了交通状况,departure_time 而 API 调用没有。您使用的是 API 密钥吗?
For driving directions: Google Maps API for Work customers can specify the departure_time to receive trip duration considering current traffic conditions