gpt4 book ai didi

google-maps - 与 Google Maps 相比,Google Maps Distance Matrix API 返回不同的输出

转载 作者:行者123 更新时间:2023-12-02 01:28:23 25 4
gpt4 key购买 nike

我正在使用网络服务修改 Google Maps API,并注意到,与 Google Maps 相比,我从 Google Maps Distance Matrix API 获得了不同的输出。

我的意思是:
https://maps.googleapis.com/maps/api/distancematrix/json?origins=Batilly&destinations=Cherbourg&language=en&key=AIzaSyAtYy7eYoooIzYGvFl15xRP2xHAdMU0-1c

这是我的查询返回的内容:

{
"destination_addresses" : [ "Cherbourg, France" ],
"origin_addresses" : [ "Batilly, France" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "195 km",
"value" : 194751
},
"duration" : {
"text" : "2 hours 3 mins",
"value" : 7373
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}

这就是 Google map 返回的内容: enter image description here

所以我得到 195 公里而不是 708 公里。问题出在巴蒂利城。瑟堡坐标很好。

Real Coordingates of Batilly are 49.171029, 5.969359(Google Maps output)
Google Maps Geocoding returns 48.7486861, -0.14727

我应该如何配置我的 Google Maps Distance Matrix API,以便它返回与 Google map 相同的输出?

最佳答案

显然在法国有不止 1 个叫 Batilly 的城市。

要获得类似于 Google map 的结果,您可以:

  1. 通过 Places-TextSearch 获取位置.对我来说,它返回所需的位置(49.1710200,5.9693580)
  2. 在 DistanceMatrix 请求中使用此位置

关于google-maps - 与 Google Maps 相比,Google Maps Distance Matrix API 返回不同的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35632160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com