【问题标题】:Google Maps Distance Matrix API returns different output compared to Google Maps与 Google Maps 相比,Google Maps Distance Matrix API 返回不同的输出
【发布时间】:2016-06-08 12:20:24
【问题描述】:

我正在使用网络服务修改 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"
}

这就是谷歌地图返回的内容:

所以我得到了 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 地图相同的输出?

【问题讨论】:

    标签: google-maps google-maps-api-3 geocoding google-geocoder


    【解决方案1】:

    法国显然不止1个城市叫巴蒂利。

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

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

    【讨论】:

    • 他也可以添加“部门”的名称,这里他的“真实”位置是“Meurthe-et-Moselle”,它会重定向到右边Batilly:@987654322 @或邮政编码
    • 真的很奇怪,地理编码器返回一个“Batily”的结果,就像地方搜索一样,但是they are different (by a 520 km drive)
    猜你喜欢
    • 2018-03-28
    • 1970-01-01
    • 2018-08-14
    • 1970-01-01
    • 2015-03-25
    • 2015-12-12
    • 2023-03-07
    • 2012-09-12
    • 1970-01-01
    相关资源
    最近更新 更多