4

我想在 Android 应用程序中使用 Google Transit API。但我正在从服务中获取数据。我使用了以下参数:

http://maps.googleapis.com/maps/api/directions/json?origin=Brooklyn&destination=Queens&sensor=false&departure_time=1343605500&mode=transit

我总是得到这样的回应:

{
   "routes" : [],
   "status" : "ZERO_RESULTS"
}

我想我在上面 URL 中使用的任何参数中传递了一些错误,也许departure_time是错误的?

谁能告诉我们应该传递什么参数?
谁能帮我找出带有返回值的此类参数的 URL?

4

1 回答 1

3

您只需将department_time 参数设置为将来的某个时间(例如几天)。从这里

请求公交路线时,请务必指定出发时间或到达时间。请注意,在此示例中,出发时间指定为 2012 年 7 月 30 日上午 09:45。在提交请求之前将参数更新为将来的某个时间点。

试试http://maps.googleapis.com/maps/api/directions/json?origin=Brooklyn&destination=Queens&sensor=false&departure_time=1350472557&mode=transit,它可以工作。

于 2012-10-12T11:19:46.170 回答