指示の取得
ルートを完了するために必要なアクションについての構造化された情報を取得するには、ルートをリクエストするときにreturn=polyline,actions
を指定します。 これは、アクションの位置やアイコンなどのユーザーインターフェースエレメントを提供する場合に役立ちます。
ルートをリクエストするときに指示アクションを含めるようにreturn=polyline,actions,instructions
を指定できます。 インストラクションには、エンドユーザーに適したアクションの説明がテキストで示されます。
curl -X GET \
'https://router.hereapi.com/v8/routes?transportMode=car&origin=52.5308,13.3847&destination=52.5323,13.3789&return=polyline,actions,instructions&apikey={YOUR_API_KEY}'
{
"routes": [
{
"id": "054ea907-d02b-4b77-b1b4-2af511291eaf",
"sections": [
{
"actions": [
{
"action": "depart",
"duration": 18,
"instruction": "Head toward Chausseestraße on Invalidenstraße. Go for 113 m.",
"offset": 0
},
{
"action": "turn",
"duration": 53,
"instruction": "Turn right onto Chausseestraße. Go for 320 m.",
"offset": 8
},
{
"action": "turn",
"duration": 15,
"instruction": "Turn left onto Habersaathstraße. Go for 105 m.",
"offset": 27
},
{
"action": "arrive",
"duration": 0,
"instruction": "Arrive at Habersaathstraße. Your destination is on the left.",
"offset": 33
}
],
"arrival": {
"place": {
"location": {
"lat": 52.53232637420297,
"lng": 13.378873988986016
},
"type": "place"
},
"time": "2019-12-09T11:59:29+01:00"
},
"departure": {
"place": {
"location": {
"lat": 52.53098367713392,
"lng": 13.384566977620125
},
"type": "place"
},
"time": "2019-12-09T11:58:03+01:00"
},
"id": "05f1eb34-0d90-488e-ae99-7e4ce384c1e3",
"polyline": "BGwynmkDu39wZvBtFAA3InfAAvHrdAAvHvbAAoGzF0FnGoGvHsOvRAA8L3NAAkSnVAAoGjIsEzFAAgFvHkDrJAAwHrJoVvb0ezoBAAjInVAA3N_iBAAzJ_Z",
"transport": {
"mode": "car"
},
"type": "vehicle"
}
]
}
]
}