Google Maps Matrix API返回状态:ZERO_RESULTS英国邮政编码

我正在使用地图矩阵API查找英格兰各个位置之间的公交距离。

https://maps.googleapis.com/maps/api/distancematrix/json?
units=metric
&key=YOUR_KEY_HERE
&origins=SE108aJ
&destinations=SE164UN
&mode=transit
&arrival_time=1568618400
&region=UK

它返回:

{
   "destination_addresses" : [ "London SE16 4UN,UK" ],"origin_addresses" : [ "Dartmouth Hill,Blackheath,London SE10 8AJ,"rows" : [
      {
         "elements" : [
            {
               "status" : "ZERO_RESULTS"
            }
         ]
      }
   ],"status" : "OK"
}

对Google地图的相同请求有效:

https://www.google.com/maps/dir/SE10+8AJ,+London/London+SE16+4UN

所以我有点困惑为什么API调用没有

liuxiaoming110 回答:Google Maps Matrix API返回状态:ZERO_RESULTS英国邮政编码

找到它了,我已经输入了过去的到达时间,将其更改为将来的时间和日期,就可以使用它。

2019-09-16 08:20:00 GMT == 1568618400

现在== 1573060070

2019-11-16 08:20:00 GMT == 1573892400

https://maps.googleapis.com/maps/api/distancematrix/json?
units=metric
&key=YOUR_KEY_HERE
&origins=SE108aJ
&destinations=SE164UN
&mode=transit
&arrival_time=1573892400
&region=UK

导致:

{
   "destination_addresses" : [ "London SE16 4UN,UK" ],"origin_addresses" : [ "Dartmouth Hill,Blackheath,London SE10 8AJ,"rows" : [
      {
         "elements" : [
            {
               "distance" : {
                  "text" : "9.1 km","value" : 9143
               },"duration" : {
                  "text" : "41 mins","value" : 2481
               },"status" : "OK"
            }
         ]
      }
   ],"status" : "OK"
}
本文链接:https://www.f2er.com/3150405.html

大家都在问