Google Distance API到达时间

时间:2015-12-12 17:37:51

标签: android json web-services rest google-maps

好的,所以我的距离矩阵请求响应就好像我没有通过它到达时间。

https://maps.googleapis.com/maps/api/distancematrix/json?origins=875+Centerville+Road+Rhode+Island&destinations=1+New+England+Tech+Blvd&key=AIzaSyAkoZCNoX406xz-mmv2_O9Hji7oAkcoN7g&transit_mode=bus&arrival_time=194976000&sensor=false

即使指定了到达时间参数,这也是我回复的响应......

{
"destination_addresses" : [ "1 New England Tech Boulevard, East Greenwich,   RI 02818, USA" ],
"origin_addresses" : [ "875 Centerville Rd, Warwick, RI 02886, USA" ],
"rows" : [
  {
     "elements" : [
        {
           "distance" : {
              "text" : "5.0 km",
              "value" : 5048
           },
           "duration" : {
              "text" : "8 mins",
              "value" : 488
           },
           "status" : "OK"
        }
     ]
  }
], "status" : "OK"
}

如果我传递的网址如下,我得到相同的回复...... https://maps.googleapis.com/maps/api/distancematrix/json?origins=875+Centerville+Road+Rhode+Island&destinations=1+New+England+Tech+Blvd&key=AIzaSyAkoZCNoX406xz-mmv2_O9Hji7oAkcoN7g

无论是否通过抵达时间,我都得到相同的结果......

{
"destination_addresses" : [ "1 New England Tech Boulevard, East Greenwich,   RI 02818, USA" ],
"origin_addresses" : [ "875 Centerville Rd, Warwick, RI 02886, USA" ],
"rows" : [
  {
     "elements" : [
        {
           "distance" : {
              "text" : "5.0 km",
              "value" : 5048
           },
           "duration" : {
              "text" : "8 mins",
              "value" : 488
           },
           "status" : "OK"
        }
     ]
  }
], "status" : "OK"
}

有人可以告诉我我做错了什么。我需要API来响应我需要离开的时间,到达我通过它的指定时间。 我没有找到一个有效的例子,这部分对我的申请至关重要。谢谢。

我对出发时间参数有一个工作响应......但是对到达时间做同样的事情并不起作用。这个API实际上不适用于到达时间吗?

https://maps.googleapis.com/maps/api/distancematrix/json?origins=875+centerville+road+Rhode+Island&destinations=1+new+england+tech+blvd+rhode+island&key=AIzaSyAkoZCNoX406xz-mmv2_O9Hji7oAkcoN7g&transit_mode=bus&departure_time=1949794160

{
"destination_addresses" : [ "1 New England Tech Boulevard, East Greenwich, RI 02818, USA" ],
"origin_addresses" : [ "875 Centerville Rd, Warwick, RI 02886, USA" ],
"rows" : [
  {
     "elements" : [
        {
           "distance" : {
              "text" : "5.0 km",
              "value" : 5048
           },
           "duration" : {
              "text" : "8 mins",
              "value" : 488
           },
           "duration_in_traffic" : {
              "text" : "7 mins",
              "value" : 432
           },
           "status" : "OK"
        }
     ]
  }
],
"status" : "OK"
}

0 个答案:

没有答案