此处REST API(fleety.ls)阿德莱德(澳大利亚)时区返回不正确,可能半小时混淆API



此处REST API fleet.ls

请考虑以下REST API调用。请注意,Long Lats位于澳大利亚阿德莱德,其TZ为+9:30。

https://fleet.ls.hereapi.com/2/calculateroute.json?waypoint0=-34.8751138.5276;路点1=-34.9042138.5708;排序&waypoint2=stopOver,600-34.893138.5546;排序&出发=2021-01-08T17:15:00&mode=最快;汽车流量:已启用&legAttributes=-li,-mn,le,bt,tt,-tm,sh&routeAttributes=sm,wp&apikey=xxxxxx

出发时间设置为:出发=2021-01-08T17:15:00

但是,摘要返回以下内容:

"summary": {
"travelTime": 1010,
"distance": 5102,
"baseTime": 882,
"trafficTime": 1010,
"flags": [],
"departure": "2021-01-08T**17:15:00+10**",
"arrival": "2021-01-08T17:31:49+10"
}

绝对时间不正确,因为该位置的时区为+9.5(或夏令时+10.5(。然后,它被传递给其他使用的算法,好吧,把一切都搞砸了半个小时。

您似乎正在使用版本7的计算路线API,如图所示。它只显示具有整小时偏移量的时间戳,例如2013-07-04T17:00:00+02

这里针对API版本8+的文档显示了一种非常不同的输出格式,包括偏移量中带有完整小时和分钟的时间戳,如2019-12-09T16:05:05+01:00。文档中的完整示例是:

{
"routes": [
{
"id": "bfaed7d0-19c7-4e72-81b7-24eeb148b62b",
"sections": [
{
"arrival": {
"place": {
"location": {
"lat": 52.53232637420297,
"lng": 13.378873988986015
},
"type": "place"
},
"time": "2019-12-09T16:05:05+01:00"
},
"departure": {
"place": {
"location": {
"lat": 52.53098367713392,
"lng": 13.384566977620125
},
"type": "place"
},
"time": "2019-12-09T16:03:02+01:00"
},
"id": "85357f8f-00ad-447e-a510-d8c02e0b264f",
"summary": {
"duration": 123,
"length": 538
},
"transport": {
"mode": "car"
},
"type": "vehicle"
}
]
}
]
}

我建议您使用API的最新v8(在撰写本文时为8.14.0(。它应该为阿德莱德提供正确的补偿。

最新更新