はじめに - HERE Developer ポータル
このセクションで は、HERE Developer ポータルで Intermodal Routing API V8 を使用してはじめにをすばやく実行する方法について説明します。
- HERE アカウントを取得
- アプリ を登録する
- API キー を入手
- リクエストを送信
HERE アカウントを取得
If you are an individual developer who has signed up for one of the plans listed on our Developer plans page on here-tech.skawa.fun, you received a HERE account ID when you signed up. You can use your HERE account to log in to here-tech.skawa.fun to create applications. Applications (uniquely identified by an app ID) enable development with HERE products and services.
アプリを登録する
アプリを登録するには、次の手順を実行します。
- Sign in to here-tech.skawa.fun.
- 名前をクリックし 、 [ プロジェクト] を選択して、一覧からプロジェクトを選択します。 プロジェクトの詳細と利用可能なアプリケーションの資格情報が表示されます。
- JavaScript または REST を選択し、 Generate アプリをクリックします。アプリケーションが作成されると、そのアプリ ID が表示されます。
API キー を入手
API キー を取得するには、次の手順を実行します。
- Sign in to here-tech.skawa.fun.
- 名前をクリックし 、 [ プロジェクト] を選択して、一覧からプロジェクトを選択します。 プロジェクトの詳細と利用可能なアプリケーションの資格情報が表示されます。
- API キー を作成をクリック して、アプリケーションに最大 2 つの API キーを生成します。 API キー が作成され、表示されます。
リクエストを送信する
この例は、ベルリンミッテの HERE キャンパスから始まり、ドイツの首都に近いポツダムへのルートを提供します。 この例では、ポツダムに到達するための少なくとも 3 つの方法を知りたいと考えています。
GET https://intermodal.router.hereapi.com/v8/routes
?apiKey={YOUR_API_KEY}
&alternatives=1
&destination=52.40358749909618,13.058351363288239
&origin=52.53105637575095,13.384944833815183
デフォルト では、 Intermodal Routing API V8 は最適なモーダル間ルートを 1 つだけ返します。 オプションのパラメータ alternatives
は、最適なルートとともに戻る代替ルートの数を表します。 デフォルトでは、に設定 alternatives=0
されています。 alternatives=2
パラメーターを渡した後、 Intermodal Routing API V8 のルーターは 、地域で利用可能なすべてのトランスポートタイプを使用して、最適な 3 つのモーダル間ルートを計算します。
モーダル間ルートの計算が成功した場合、 /routes
応答には計算されたルートについて要求された詳細情報が含まれます。
- 3 つの最適なモーダル間ルート。
- 以下の輸送タイプの 1 つまたは組み合わせ。各輸送タイプには、出発時間と到着時間、所要時間、座標、およびその他のセクション情報が含まれています。
taxi
transit
vehicle
rented
pedestrian
- 代替品に含まれているサービスを実行するオペレータのセット。オペレータコード、オペレータ名、オペレータの Web サイトへのリンク ( 存在する場合 ) などが含まれます。
注
複数のオプションのパラメータ ( 特に departureTime
arrivalTime
、、 ) を指定しないため <transport-type>[enable]=<route-section>
、以下に示すような出力結果が返されない場合があります。
{
"routes": [
{
"id": "R00347b-C0",
"sections": [
{
"id": "R00347b-C0-S0",
"type": "pedestrian",
"notices": [
{
"code": "walkOptionViolated"
}
],
"departure": {
"time": "2020-04-28T17:53:00+02:00",
"place": {
"type": "place",
"location": {
"lat": 52.531055,
"lng": 13.384947
}
}
},
"arrival": {
"time": "2020-04-28T17:57:00+02:00",
"place": {
"name": "U Naturkundemuseum [Invalidenstr.]",
"type": "station",
"location": {
"lat": 52.530336,
"lng": 13.382223
},
"id": "vbb_900100709"
}
}
},
{
"id": "R00347b-C0-S1",
"type": "transit",
"departure": {
"time": "2020-04-28T17:57:00+02:00",
"place": {
"name": "U Naturkundemuseum [Invalidenstr.]",
"type": "station",
"location": {
"lat": 52.530336,
"lng": 13.382223
},
"id": "vbb_900100709"
},
"delay": 0
},
"arrival": {
"time": "2020-04-28T18:01:00+02:00",
"place": {
"name": "S+U Berlin Hauptbahnhof",
"type": "station",
"location": {
"lat": 52.52585,
"lng": 13.368928
},
"id": "vbb_900003201"
},
"delay": 0
},
"transport": {
"mode": "lightRail",
"name": "Tram M10",
"category": "Tram",
"color": "#DF6A1C",
"textColor": "#FFFFFF",
"headsign": "S+U Hauptbahnhof"
},
"agency": {
"id": "BVG",
"name": "Berliner Verkehrsbetriebe"
}
},
{
"id": "R00347b-C0-S2",
"type": "transit",
"departure": {
"time": "2020-04-28T18:12:00+02:00",
"place": {
"name": "S+U Berlin Hauptbahnhof",
"type": "station",
"location": {
"lat": 52.52585,
"lng": 13.368928
},
"id": "vbb_900003201",
"platform": "14"
},
"delay": 60
},
"arrival": {
"time": "2020-04-28T18:36:00+02:00",
"place": {
"name": "S Potsdam Hauptbahnhof",
"type": "station",
"location": {
"lat": 52.390931,
"lng": 13.067187
},
"id": "vbb_900230999",
"platform": "3"
},
"delay": 0
},
"transport": {
"mode": "regionalTrain",
"name": "RE1",
"category": "RE",
"color": "#D7081D",
"textColor": "#FFFFFF",
"headsign": "Magdeburg, Hauptbahnhof"
},
"agency": {
"id": "DB",
"name": "DB Regio AG"
}
},
{
"id": "R00347b-C0-S3",
"type": "transit",
"departure": {
"time": "2020-04-28T18:42:00+02:00",
"place": {
"name": "S Potsdam Hauptbahnhof",
"type": "station",
"location": {
"lat": 52.390931,
"lng": 13.067187
},
"id": "vbb_900230999",
"platform": "2"
}
},
"arrival": {
"time": "2020-04-28T18:49:00+02:00",
"place": {
"name": "Potsdam, Nauener Tor",
"type": "station",
"location": {
"lat": 52.403102,
"lng": 13.057919
},
"id": "vbb_900230022"
}
},
"transport": {
"mode": "lightRail",
"name": "Tram 96",
"category": "Tram",
"color": "#CC0A22",
"textColor": "#FFFFFF",
"headsign": "Potsdam, Campus Jungfernsee"
},
"agency": {
"id": "ViP",
"name": "Verkehrsbetrieb Potsdam GmbH"
}
},
{
"id": "R00347b-C0-S4",
"type": "pedestrian",
"notices": [
{
"code": "walkOptionViolated"
}
],
"departure": {
"time": "2020-04-28T18:49:00+02:00",
"place": {
"name": "Potsdam, Nauener Tor",
"type": "station",
"location": {
"lat": 52.403102,
"lng": 13.057919
},
"id": "vbb_900230022"
}
},
"arrival": {
"time": "2020-04-28T18:51:00+02:00",
"place": {
"type": "place",
"location": {
"lat": 52.403588,
"lng": 13.058351
}
}
}
}
]
},
{
"id": "R00347b-C1",
"sections": [
{
"id": "R00347b-C1-S0",
"type": "pedestrian",
"notices": [
{
"code": "walkOptionViolated"
}
],
"departure": {
"time": "2020-04-28T18:03:00+02:00",
"place": {
"type": "place",
"location": {
"lat": 52.531055,
"lng": 13.384947
}
}
},
"arrival": {
"time": "2020-04-28T18:07:00+02:00",
"place": {
"name": "U Naturkundemuseum [Invalidenstr.]",
"type": "station",
"location": {
"lat": 52.530336,
"lng": 13.382223
},
"id": "vbb_900100709"
}
}
},
{
"id": "R00347b-C1-S1",
"type": "transit",
"departure": {
"time": "2020-04-28T18:07:00+02:00",
"place": {
"name": "U Naturkundemuseum [Invalidenstr.]",
"type": "station",
"location": {
"lat": 52.530336,
"lng": 13.382223
},
"id": "vbb_900100709"
},
"delay": 0
},
"arrival": {
"time": "2020-04-28T18:11:00+02:00",
"place": {
"name": "S+U Berlin Hauptbahnhof",
"type": "station",
"location": {
"lat": 52.52585,
"lng": 13.368928
},
"id": "vbb_900003201"
},
"delay": 0
},
"transport": {
"mode": "lightRail",
"name": "Tram M10",
"category": "Tram",
"color": "#DF6A1C",
"textColor": "#FFFFFF",
"headsign": "S+U Hauptbahnhof"
},
"agency": {
"id": "BVG",
"name": "Berliner Verkehrsbetriebe"
}
},
{
"id": "R00347b-C1-S2",
"type": "transit",
"departure": {
"time": "2020-04-28T18:17:00+02:00",
"place": {
"name": "S+U Berlin Hauptbahnhof",
"type": "station",
"location": {
"lat": 52.52585,
"lng": 13.368928
},
"id": "vbb_900003201",
"platform": "16"
},
"delay": 0
},
"arrival": {
"time": "2020-04-28T18:52:00+02:00",
"place": {
"name": "S Potsdam Hauptbahnhof",
"type": "station",
"location": {
"lat": 52.390931,
"lng": 13.067187
},
"id": "vbb_900230999",
"platform": "6"
},
"delay": 0
},
"transport": {
"mode": "cityTrain",
"name": "S7",
"category": "S-Bahn",
"color": "#7760B0",
"textColor": "#FFFFFF",
"headsign": "S Potsdam Hauptbahnhof"
},
"agency": {
"id": "DBS",
"name": "S-Bahn Berlin GmbH"
}
},
{
"id": "R00347b-C1-S3",
"type": "transit",
"departure": {
"time": "2020-04-28T18:57:00+02:00",
"place": {
"name": "S Potsdam Hauptbahnhof",
"type": "station",
"location": {
"lat": 52.390931,
"lng": 13.067187
},
"id": "vbb_900230999",
"platform": "2"
},
"delay": 0
},
"arrival": {
"time": "2020-04-28T19:04:00+02:00",
"place": {
"name": "Potsdam, Nauener Tor",
"type": "station",
"location": {
"lat": 52.403102,
"lng": 13.057919
},
"id": "vbb_900230022"
},
"delay": 0
},
"transport": {
"mode": "lightRail",
"name": "Tram 92",
"category": "Tram",
"color": "#CC0A22",
"textColor": "#FFFFFF",
"headsign": "Potsdam, Kirschallee"
},
"agency": {
"id": "ViP",
"name": "Verkehrsbetrieb Potsdam GmbH"
}
},
{
"id": "R00347b-C1-S4",
"type": "pedestrian",
"notices": [
{
"code": "walkOptionViolated"
}
],
"departure": {
"time": "2020-04-28T19:04:00+02:00",
"place": {
"name": "Potsdam, Nauener Tor",
"type": "station",
"location": {
"lat": 52.403102,
"lng": 13.057919
},
"id": "vbb_900230022"
}
},
"arrival": {
"time": "2020-04-28T19:06:00+02:00",
"place": {
"type": "place",
"location": {
"lat": 52.403588,
"lng": 13.058351
}
}
}
}
]
}
]
}