ガイドAPIリファレンス
ガイド

さまざまなタイプのユニットを使用する指示をリクエストする

ガイダンス指示の測定単位は、リクエストの一部として指定できます。

サポートされている単位はmetricimperialです。デフォルト値は metric です。

このパラメーターは、アクション命令 (return=actions,instructionsとして指定) で使用される単位以外の他の単位には影響しません。 他の単位 (summarytravelSummaryなど) は、マシン間通信を目的としており、ユーザーに直接表示するためのものではありません。そのため、単一の測定単位系が使用されています。このほうが、エラーが発生しにくくなります。

ただし、命令文字列はユーザーに直接公開されることを目的としているため (Webサイト上のアクションのリストなど)、命令文字列内で単位を変更するオプションがあります。

メートル単位の例

curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'transportMode=car&'\
'origin=52.509739,13.380260&'\
'destination=52.508419,13.385007&'\
'units=metric&'\
'return=polyline,actions,instructions&'\
'apiKey=YOUR_API_KEY'
{
  "routes": [
    {
      "id": "8db0de88-157d-43ac-8ebd-5319d0bea975",
      "sections": [
        {
          "id": "196a68a2-db65-4151-9fad-64036e935fef",
          "type": "vehicle",
          "actions": [
            {
              "action": "depart",
              "duration": 38,
              "instruction": "Head toward Wilhelmstraße on Leipziger Straße (B1). Go for 269 m.",
              "offset": 0
            },
            {
              "action": "turn",
              "duration": 20,
              "instruction": "Turn right onto Platz des Volksaufstandes von 1953 toward Tempelhof/Kreuzberg. Go for 184 m.",
              "offset": 5,
              "direction": "right",
              "severity": "quite"
            },
            {
              "action": "arrive",
              "duration": 0,
              "instruction": "Arrive at Wilhelmstraße.",
              "offset": 10
            }
          ],
          ...
        }
      ]
    }
  ]
}

インペリアル単位の例

curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'transportMode=car&'\
'origin=52.509739,13.380260&'\
'destination=52.508419,13.385007&'\
'units=imperial&'\
'return=polyline,actions,instructions&'\
'apiKey=YOUR_API_KEY'
{
  "routes": [
    {
      "id": "cb55a003-d8fe-43fe-a202-55b55f541d17",
      "sections": [
        {
          "id": "0c70753e-9861-4442-98df-aaf4e44aaa68",
          "type": "vehicle",
          "actions": [
            {
              "action": "depart",
              "duration": 38,
              "instruction": "Head toward Wilhelmstraße on Leipziger Straße (B1). Go for 0.2 mi.",
              "offset": 0
            },
            {
              "action": "turn",
              "duration": 20,
              "instruction": "Turn right onto Platz des Volksaufstandes von 1953 toward Tempelhof/Kreuzberg. Go for 0.1 mi.",
              "offset": 5,
              "direction": "right",
              "severity": "quite"
            },
            {
              "action": "arrive",
              "duration": 0,
              "instruction": "Arrive at Wilhelmstraße.",
              "offset": 10
            }
          ],
          ...
        }
      ]
    }
  ]
}