当前位置: 首页 > 知识库问答 >
问题:

确定运输方向有什么问题?

申屠浩歌
2023-03-14

当我使用此url获取行驶方向时,它会正确地获取json,并且工作正常:

http://maps.googleapis.com/maps/api/directions/json?origin=sourcelat,sourcelog

当我想获得运输方向时,我使用这个url,但它不起作用:

http://maps.googleapis.com/maps/api/directions/json?origin=sourcelat,sourcelog

谁能告诉我我的问题是什么?来源地和目的地都在巴黎。

共有1个答案

钦永贞
2023-03-14

请求中转方向时,必须指定出发时间到达时间中的一个。自UTC 1970年1月1日午夜起,这些时间以秒为单位表示。

以下URL请求2013年9月29日(星期日)中午从卢浮宫到埃菲尔铁塔的交通方向。http://maps.googleapis.com/maps/api/directions/json?origin=48.8611,2.3364

以下是JSON的回应:

{
   "routes" : [
      {
         "bounds" : {
            "northeast" : {
               "lat" : 48.862972,
               "lng" : 2.3367707
            },
            "southwest" : {
               "lat" : 48.855014,
               "lng" : 2.2890295
            }
         },
         "copyrights" : "Map data ©2013 Cybercity, Google",
         "legs" : [
            {
               "arrival_time" : {
                  "text" : "2:37pm",
                  "time_zone" : "Europe/Paris",
                  "value" : 1380458251
               },
               "departure_time" : {
                  "text" : "2:00pm",
                  "time_zone" : "Europe/Paris",
                  "value" : 1380456000
               },
               "distance" : {
                  "text" : "4.9 km",
                  "value" : 4885
               },
               "duration" : {
                  "text" : "38 mins",
                  "value" : 2251
               },
               "end_address" : "Avenue Anatole France, 75007 Paris, France",
               "end_location" : {
                  "lat" : 48.858329,
                  "lng" : 2.2946919
               },
               "start_address" : "Cour Carrée et Pyramide du Louvre, 75001 Paris, France",
               "start_location" : {
                  "lat" : 48.8610339,
                  "lng" : 2.3367707
               },
               "steps" : [
                  {
                     "distance" : {
                        "text" : "1.1 km",
                        "value" : 1061
                     },
                     "duration" : {
                        "text" : "13 mins",
                        "value" : 809
                     },
                     "end_location" : {
                        "lat" : 48.860817,
                        "lng" : 2.325676
                     },
                     "html_instructions" : "Walk to Musée d'Orsay",
                     "polyline" : {
                        "points" : "mdfiHykgMh@P|At@@?@@?@?B?B}ApJCDC?CXIb@Id@vBfAXNFDFDFDGb@gAdIg@zDDNBNDT?@?B@B@B?BBB@B@?PN@@@@BH^V|AbAZTRt@ER[|ASz@KPEFEHELQd@_@bA[z@KXIXG\\a@pBS~@PJU|@"
                     },
                     "start_location" : {
                        "lat" : 48.8610339,
                        "lng" : 2.3367707
                     },
                     "steps" : [
                        {
                           "distance" : {
                              "text" : "0.3 km",
                              "value" : 275
                           },
                           "duration" : {
                              "text" : "3 mins",
                              "value" : 198
                           },
                           "end_location" : {
                              "lat" : 48.8609596,
                              "lng" : 2.3339723
                           },
                           "html_instructions" : "Head \u003cb\u003esouth\u003c/b\u003e on \u003cb\u003eCour Carrée et Pyramide du Louvre\u003c/b\u003e toward \u003cb\u003ePl. du Carrousel\u003c/b\u003e",
                           "polyline" : {
                              "points" : "mdfiHykgMh@P|At@@?@@?@?B?B}ApJCDC?CXIb@Id@"
                           },
                           "start_location" : {
                              "lat" : 48.8610339,
                              "lng" : 2.3367707
                           },
                           "travel_mode" : "WALKING"
                        },
                        {
                           "distance" : {
                              "text" : "0.1 km",
                              "value" : 103
                           },
                           "duration" : {
                              "text" : "1 min",
                              "value" : 78
                           },
                           "end_location" : {
                              "lat" : 48.8601075,
                              "lng" : 2.3334357
                           },
                           "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003ePl. du Carrousel\u003c/b\u003e",
                           "maneuver" : "turn-left",
                           "polyline" : {
                              "points" : "_dfiHizfMvBfAXNFDFDFD"
                           },
                           "start_location" : {
                              "lat" : 48.8609596,
                              "lng" : 2.3339723
                           },
                           "travel_mode" : "WALKING"
                        },
                        {
                           "distance" : {
                              "text" : "0.2 km",
                              "value" : 211
                           },
                           "duration" : {
                              "text" : "3 mins",
                              "value" : 171
                           },
                           "end_location" : {
                              "lat" : 48.8607092,
                              "lng" : 2.3306935
                           },
                           "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003eQuai François Mitterrand\u003c/b\u003e",
                           "maneuver" : "turn-right",
                           "polyline" : {
                              "points" : "u~eiH_wfMGb@gAdIg@zD"
                           },
                           "start_location" : {
                              "lat" : 48.8601075,
                              "lng" : 2.3334357
                           },
                           "travel_mode" : "WALKING"
                        },
                        {
                           "distance" : {
                              "text" : "0.2 km",
                              "value" : 170
                           },
                           "duration" : {
                              "text" : "2 mins",
                              "value" : 137
                           },
                           "end_location" : {
                              "lat" : 48.8595728,
                              "lng" : 2.3293037
                           },
                           "html_instructions" : "Slight \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003ePont Royal\u003c/b\u003e",
                           "maneuver" : "turn-slight-left",
                           "polyline" : {
                              "points" : "mbfiHyefMDNBNDT?@?B@B@B?BBB@B@?PN@@@@BH^V|AbAZTRt@"
                           },
                           "start_location" : {
                              "lat" : 48.8607092,
                              "lng" : 2.3306935
                           },
                           "travel_mode" : "WALKING"
                        },
                        {
                           "distance" : {
                              "text" : "71 m",
                              "value" : 71
                           },
                           "duration" : {
                              "text" : "1 min",
                              "value" : 51
                           },
                           "end_location" : {
                              "lat" : 48.8598405,
                              "lng" : 2.3284286
                           },
                           "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003eQuai Anatole France\u003c/b\u003e",
                           "maneuver" : "turn-right",
                           "polyline" : {
                              "points" : "i{eiHc}eMER[|ASz@"
                           },
                           "start_location" : {
                              "lat" : 48.8595728,
                              "lng" : 2.3293037
                           },
                           "travel_mode" : "WALKING"
                        },
                        {
                           "distance" : {
                              "text" : "0.2 km",
                              "value" : 205
                           },
                           "duration" : {
                              "text" : "2 mins",
                              "value" : 140
                           },
                           "end_location" : {
                              "lat" : 48.860707,
                              "lng" : 2.325993
                           },
                           "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eDestination will be on the left\u003c/div\u003e",
                           "maneuver" : "turn-slight-right",
                           "polyline" : {
                              "points" : "_}eiHuweMKPEFEHELQd@_@bA[z@KXIXG\\a@pBS~@PJ"
                           },
                           "start_location" : {
                              "lat" : 48.8598405,
                              "lng" : 2.3284286
                           },
                           "travel_mode" : "WALKING"
                        },
                        {
                           "distance" : {
                              "text" : "26 m",
                              "value" : 26
                           },
                           "duration" : {
                              "text" : "1 min",
                              "value" : 34
                           },
                           "end_location" : {
                              "lat" : 48.860817,
                              "lng" : 2.325676
                           },
                           "polyline" : {
                              "points" : "mbfiHmheMU|@"
                           },
                           "start_location" : {
                              "lat" : 48.860707,
                              "lng" : 2.325993
                           },
                           "travel_mode" : "WALKING"
                        }
                     ],
                     "travel_mode" : "WALKING"
                  },
                  {
                     "distance" : {
                        "text" : "3.2 km",
                        "value" : 3151
                     },
                     "duration" : {
                        "text" : "7 mins",
                        "value" : 442
                     },
                     "end_location" : {
                        "lat" : 48.855014,
                        "lng" : 2.289154
                     },
                     "html_instructions" : "Train towards Versailles - Château / Saint-Quentin / Chaville - Vélizy / Pontoise",
                     "polyline" : {
                        "points" : "ccfiHofeMVNgJpc@}@hGU|BIvBJrVFrN@tKPrZNpSBf@XlG~BtLpDlJlJnOtHrL|CzCnBp@zCrAxAz@FW"
                     },
                     "start_location" : {
                        "lat" : 48.860817,
                        "lng" : 2.325676
                     },
                     "transit_details" : {
                        "arrival_stop" : {
                           "location" : {
                              "lat" : 48.855014,
                              "lng" : 2.289154
                           },
                           "name" : "Champ de Mars - Tour Eiffel"
                        },
                        "arrival_time" : {
                           "text" : "2:28pm",
                           "time_zone" : "Europe/Paris",
                           "value" : 1380457730
                        },
                        "departure_stop" : {
                           "location" : {
                              "lat" : 48.860817,
                              "lng" : 2.325676
                           },
                           "name" : "Musée d'Orsay"
                        },
                        "departure_time" : {
                           "text" : "2:21pm",
                           "time_zone" : "Europe/Paris",
                           "value" : 1380457288
                        },
                        "headsign" : "Versailles - Château / Saint-Quentin / Chaville - Vélizy / Pontoise",
                        "headway" : 478,
                        "line" : {
                           "agencies" : [
                              {
                                 "name" : "RATP - SNCF"
                              }
                           ],
                           "color" : "#f2c71c",
                           "short_name" : "RER C",
                           "text_color" : "#000000",
                           "vehicle" : {
                              "icon" : "//maps.gstatic.com/mapfiles/transit/iw/6/rail.png",
                              "local_icon" : "//maps.gstatic.com/mapfiles/transit/iw/6/fr-paris-rail.png",
                              "name" : "Train",
                              "type" : "HEAVY_RAIL"
                           }
                        },
                        "num_stops" : 3
                     },
                     "travel_mode" : "TRANSIT"
                  },
                  {
                     "distance" : {
                        "text" : "0.7 km",
                        "value" : 673
                     },
                     "duration" : {
                        "text" : "9 mins",
                        "value" : 519
                     },
                     "end_location" : {
                        "lat" : 48.858329,
                        "lng" : 2.2946919
                     },
                     "html_instructions" : "Walk to Avenue Anatole France, 75007 Paris, France",
                     "polyline" : {
                        "points" : "y~diHeb~LcMuJQVACO_@K]cAiBaAcBo@cAqAwBLWm@cAbCmE"
                     },
                     "start_location" : {
                        "lat" : 48.855014,
                        "lng" : 2.289154
                     },
                     "steps" : [
                        {
                           "distance" : {
                              "text" : "0.3 km",
                              "value" : 285
                           },
                           "duration" : {
                              "text" : "4 mins",
                              "value" : 225
                           },
                           "end_location" : {
                              "lat" : 48.857269,
                              "lng" : 2.291018
                           },
                           "polyline" : {
                              "points" : "y~diHeb~LcMuJ"
                           },
                           "start_location" : {
                              "lat" : 48.855014,
                              "lng" : 2.289154
                           },
                           "travel_mode" : "WALKING"
                        },
                        {
                           "distance" : {
                              "text" : "0.2 km",
                              "value" : 235
                           },
                           "duration" : {
                              "text" : "3 mins",
                              "value" : 186
                           },
                           "end_location" : {
                              "lat" : 48.8588284,
                              "lng" : 2.2932032
                           },
                           "html_instructions" : "Head \u003cb\u003enortheast\u003c/b\u003e on \u003cb\u003eQuai Branly\u003c/b\u003e toward \u003cb\u003ePromenade d'Australie\u003c/b\u003e",
                           "polyline" : {
                              "points" : "}leiH{m~LQVACO_@K]cAiBaAcBo@cAqAwB"
                           },
                           "start_location" : {
                              "lat" : 48.857269,
                              "lng" : 2.291018
                           },
                           "travel_mode" : "WALKING"
                        },
                        {
                           "distance" : {
                              "text" : "11 m",
                              "value" : 11
                           },
                           "duration" : {
                              "text" : "1 min",
                              "value" : 12
                           },
                           "end_location" : {
                              "lat" : 48.8587578,
                              "lng" : 2.2933179
                           },
                           "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e",
                           "maneuver" : "turn-right",
                           "polyline" : {
                              "points" : "uveiHo{~LLW"
                           },
                           "start_location" : {
                              "lat" : 48.8588284,
                              "lng" : 2.2932032
                           },
                           "travel_mode" : "WALKING"
                        },
                        {
                           "distance" : {
                              "text" : "36 m",
                              "value" : 36
                           },
                           "duration" : {
                              "text" : "1 min",
                              "value" : 27
                           },
                           "end_location" : {
                              "lat" : 48.858994,
                              "lng" : 2.2936589
                           },
                           "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e",
                           "maneuver" : "turn-left",
                           "polyline" : {
                              "points" : "gveiHg|~Lm@cA"
                           },
                           "start_location" : {
                              "lat" : 48.8587578,
                              "lng" : 2.2933179
                           },
                           "travel_mode" : "WALKING"
                        },
                        {
                           "distance" : {
                              "text" : "0.1 km",
                              "value" : 106
                           },
                           "duration" : {
                              "text" : "1 min",
                              "value" : 69
                           },
                           "end_location" : {
                              "lat" : 48.858329,
                              "lng" : 2.2946919
                           },
                           "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eDestination will be on the right\u003c/div\u003e",
                           "maneuver" : "turn-right",
                           "polyline" : {
                              "points" : "uweiHk~~LbCmE"
                           },
                           "start_location" : {
                              "lat" : 48.858994,
                              "lng" : 2.2936589
                           },
                           "travel_mode" : "WALKING"
                        }
                     ],
                     "travel_mode" : "WALKING"
                  }
               ],
               "via_waypoint" : []
            }
         ],
         "overview_polyline" : {
            "points" : "mdfiHykgMh@P|At@B@}AzJGDCXShApCvANJFDGb@oB`OH^F^FNVRBH^VxBxARt@ERo@xC]p@mAdDUr@i@nCS~@PJU|@VNgJpc@}@hGU|BIvBRff@@tKPrZRxTXlG~BtLpDlJlJnOtHrL|CzCnBp@zCrAxAz@FWcMuJQVQc@K]cAiBqBgDqAwBLWm@cAbCmE"
         },
         "summary" : "",
         "warnings" : [
            "Walking directions are in beta.    Use caution – This route may be missing sidewalks or pedestrian paths."
         ],
         "waypoint_order" : []
      }
   ],
   "status" : "OK"
}

参考:谷歌方向API:RequestParameters

 类似资料:
  • 我正在尝试为重定向绑定创建SAML AuthnRequest。 这是我的(匿名)授权请求: 我有一个中继状态: SigAlg是http://www.w3.org/2001/04/xmldsig-more#rsa-sha256 我对请求进行放气,然后进行base64编码,然后进行URL编码。(缩小后的base64编码结果在SAMLTool解码器中检出。) 用于创建签名的结果字符串如下所示: 我尝试使

  • 我试图创建一个图,它将有V个顶点。我正在使用向量的向量来表示图(作为邻接列表)。我的图中的节点是从0到V-1的编号,所以adj向量的索引代表了节点的数量。除非我搞错了,adj[u]代表一个向量,所以我应该可以使用adj[u].push_back(v)将顶点v推入顶点u的邻接列表中。所以在我的例子中,adj[4]应该得到与节点4相邻的顶点所在的向量,而.push_back(1) 这不会发生的。我想这

  • 问题内容: 什么是重定向的区别使用输出,,和? 问题答案: 将 标准输出 重定向到文件 将文件句柄“ 2”(几乎总是 stderr )重定向到其他文件句柄(通常写为,这会将stderr重定向到与stdout相同的位置)。 并将 stdout* 和 stderr都重定向到文件。通常写为(或)。在功能上与相同。 *** 将输出重定向到文件句柄2(通常是 stderr )到文件。

  • 问题内容: 我正在使用Java运行这个命令。脚本正在运行,但它没有将流重定向到文件。此外,文件没有被创建。 如果我在shell上运行这个脚本,它运行得很好。 有什么想法吗? 问题答案: 你需要使用重定向。

  • 尝试编写并执行MySQL查询,以显示所有成本低于50美元的动作或喜剧电影的电影编号、电影标题、电影成本和电影类型。按流派按升序对结果进行排序。

  • 我试图在一些json中使用retro fit,但看不出我的json字符串有什么问题,我总是得到同样的错误。 我在期待一个单词对象列表,但我错过了什么?有什么想法吗? 改造Android代码: API接口: