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

セクションあたりの燃料消費量とCO2排出量を計算する

このチュートリアルでは、燃料ベースのディーゼル車の燃料消費量を返すルート検索リクエストの例を示します。

各リクエストでは、fuel[freeFlowSpeedTable]パラメーターとfuel[trafficSpeedTable]パラメーターを使用して燃料消費量テーブルが提供されます。

レスポンスでは燃料消費量をリットル (L) 単位で指定します。

交通量を有効にした燃料消費量の計算

curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=52.542146,13.347508&'\
'destination=52.512139,13.438468&'\
'via=52.527319,13.387999!passThrough=true&'\
'return=summary,polyline&'\
'transportMode=car&'\
'departureTime=2024-09-04T11:00:00&'\
'fuel[type]=diesel&'\
'fuel[freeFlowSpeedTable]=10,0.095,20,0.072,30,0.058,40,0.049,50,0.045,60,0.043,70,0.042,80,0.043,90,0.045,100,0.047,110,0.05,120,0.052,130,0.055&'\
'fuel[trafficSpeedTable]=10,0.012,20,0.09,30,0.07,40,0.06,50,0.045,60,0.043,70,0.042,80,0.043,90,0.045,100,0.047,110,0.05,120,0.052,130,0.055&'\
'fuel[additionalConsumption]=0.1&'\
'fuel[ascent]=0.1&'\
'apiKey=YOUR_API_KEY'
{
  "routes": [
    {
      "id": "4843146e-b1c2-4fad-b239-96841ce9526c",
      "sections": [
        {
          ...,
          "summary": {
            "duration": 1353,
            "length": 8705,
            "consumption": 0.6295,
            "baseDuration": 1008,
            "co2Emission": 1.698
          },
          "transport": {
            "mode": "car"
          },
          "consumptionType": "diesel"
        }
      ]
    }
  ]
}

交通量を無効にした燃料消費量の計算

この例では、パラメーターtraffic[mode]=disabledを使用して交通量が無効になっている点を除いて、前の例と同じリクエストを使用します。

レスポンスでは、ルートのlengthは以前と同じですが、車両が交通量によって減速していないため、durationconsumptionco2Emissionが減少します。

curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=52.542146,13.347508&'\
'destination=52.512139,13.438468&'\
'via=52.527319,13.387999!passThrough=true&'\
'return=summary,polyline&'\
'transportMode=car&'\
'departureTime=2024-09-04T11:00:00&'\
'fuel[type]=diesel&'\
'fuel[freeFlowSpeedTable]=10,0.095,20,0.072,30,0.058,40,0.049,50,0.045,60,0.043,70,0.042,80,0.043,90,0.045,100,0.047,110,0.05,120,0.052,130,0.055&'\
'fuel[trafficSpeedTable]=10,0.012,20,0.09,30,0.07,40,0.06,50,0.045,60,0.043,70,0.042,80,0.043,90,0.045,100,0.047,110,0.05,120,0.052,130,0.055&'\
'fuel[additionalConsumption]=0.1&'\
'fuel[ascent]=0.1&'\
'traffic[mode]=disabled&'\
'apiKey=YOUR_API_KEY'
{
  "routes": [
    {
      "id": "424e62f5-b0b0-4118-95b1-cb96d0a5fa2e",
      "sections": [
        {
          ...,
          "summary": {
            "duration": 1008,
            "length": 8705,
            "consumption": 0.5668,
            "baseDuration": 1008,
            "co2Emission": 1.529
          },
          "transport": {
            "mode": "car"
          },
          "consumptionType": "diesel"
        }
      ]
    }
  ]
}

スパンあたりの燃料消費量を計算する

このリクエストは、燃料ベースのディーゼル車の燃料消費量をスパンごとに返します。

curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=52.542146,13.347508&'\
'destination=52.512139,13.438468&'\
'via=52.527319,13.387999!passThrough=true&'\
'return=summary,polyline&'\
'spans=maxSpeed,consumption&'\
'transportMode=car&'\
'departureTime=2024-09-04T11:00:00&'\
'fuel[type]=diesel&'\
'fuel[freeFlowSpeedTable]=10,0.095,20,0.072,30,0.058,40,0.049,50,0.045,60,0.043,70,0.042,80,0.043,90,0.045,100,0.047,110,0.05,120,0.052,130,0.055&'\
'fuel[trafficSpeedTable]=10,0.012,20,0.09,30,0.07,40,0.06,50,0.045,60,0.043,70,0.042,80,0.043,90,0.045,100,0.047,110,0.05,120,0.052,130,0.055&'\
'fuel[additionalConsumption]=0.1&'\
'fuel[ascent]=0.1&'\
'apiKey=YOUR_API_KEY'
{
  "routes": [
    {
      "id": "b832f221-e207-4d30-a487-05fb13597c0b",
      "sections": [
        {
          ...,
          "summary": {
            "duration": 1371,
            "length": 8705,
            "consumption": 0.6273,
            "baseDuration": 1008,
            "co2Emission": 1.692
          },
          "polyline": "...",
          "spans": [
            {
              "offset": 0,
              "maxSpeed": 8.333334,
              "consumption": 0.006
            },
            {
              "offset": 2,
              "maxSpeed": 13.8888893,
              "consumption": 0.0509
            },
            {
              "offset": 24,
              "maxSpeed": 8.333334,
              "consumption": 0.0351
            },
            {
              "offset": 35,
              "maxSpeed": 13.8888893,
              "consumption": 0.1971
            },
            {
              "offset": 138,
              "maxSpeed": 8.333334,
              "consumption": 0.1494
            },
            {
              "offset": 211,
              "maxSpeed": 13.8888893,
              "consumption": 0.1194
            },
            {
              "offset": 265,
              "maxSpeed": 8.333334,
              "consumption": 0.0045
            },
            {
              "offset": 267,
              "maxSpeed": 13.8888893,
              "consumption": 0.0649
            }
          ],
          "transport": {
            "mode": "car"
          },
          "consumptionType": "diesel"
        }
      ]
    }
  ]
}