不完全な位置クエリを使用して場所の候補を取得する
このチュートリアルでは、不完全な位置クエリを使用して場所を検索する方法を示します。
手順
/autosuggestエンドポイントを使用しているアプリケーションのユーザーがベルリンのある場所で、
_Berlin Brandenburg Willy Brandt_という名前の新しい空港を「Berlin Brandenburg」というクエリで検索しようとしています。アプリケーションは3文字目の入力から
/autosuggestエンドポイントへのクエリ送信を開始します。8つ目の自動候補提示クエリは次のようになります。
GET https://autosuggest.search.hereapi.com/v1/
autosuggest
?at=52.5199813,13.3985138
&lang=en
&q=berlin+bran
&apiKey={YOUR_API_KEY}次のパラメーターを使用します。
- at - 座標で表される検索コンテキストの中心を指定します。
- lang - BCP 47 に準拠した言語コードのリストから、結果のレンダリングに使用する言語を選択します。
- q - 名前を入力します。
- apiKey - APIキー。
注
このリクエストはAPIキー認証を使用します。HEREプラットフォームの認証オプションの詳細については、「Identity & Access Management Guide」(IDとアクセス管理ガイド)を参照してください。
結果には関連する位置オブジェクトに関する詳細情報が表示されます。
{
"items": [
{
"title": "Brandenburg Gate",
"id": "here:pds:place:276u33db-8ee2e0de906e459cbade0593986debe9",
"resultType": "place",
"address": { "label": "Brandenburg Gate, Pariser Platz 1, 10117 Berlin, Germany" },
"position": { "lat": 52.51628, "lng": 13.37771 },
"access": [{ "lat": 52.5163, "lng": 13.37799 }],
"distance": 1466,
"categories": [{ "id": "300-3000-0025", "name": "Historical Monument", "primary": true }, { "id": "700-7460-0115", "name": "Tourist Information" }],
"references": [{ "supplier": { "id": "core" }, "id": "800842663" }, { "supplier": { "id": "core" }, "id": "935939740" }],
"highlights": { "title": [ ], "address": { "label": [ ] } }
},
{
"title": "Berlin Brandenburg Airport Willy Brandt",
"id": "here:pds:place:276u339g-0dd32a93728c47c3b35985e550f30a70",
"resultType": "place",
"address": { "label": "Berlin Brandenburg Airport Willy Brandt, Melli-Beese-Ring 1, 12529 Schönefeld, Germany" },
"position": { "lat": 52.36395, "lng": 13.50864 },
"access": [{ "lat": 52.36447, "lng": 13.51003 }],
"distance": 18887,
"categories": [{ "id": "400-4000-4581", "name": "Airport", "primary": true }],
"references": [{ "supplier": { "id": "core" }, "id": "1098368287" }, { "supplier": { "id": "yelp" }, "id": "L4LMcEkbutFG3bz-1i-keg" }],
"highlights": { "title": [ ], "address": { "label": [ ] } }
},
{
"title": "Gesundbrunnen Center",
"id": "here:pds:place:276u33db-84435950c4084967be9ccca7c6603d4e",
"resultType": "place",
"address": { "label": "Gesundbrunnen Center, Badstraße 4, 13357 Berlin, Germany" },
"position": { "lat": 52.54971, "lng": 13.38749 },
"access": [{ "lat": 52.54965, "lng": 13.3874 }],
"distance": 3389,
"categories": [
{ "id": "600-6100-0062", "name": "Shopping Mall", "primary": true },
...
],
"chains": [{ "id": "6825" }],
"references": [
{ "supplier": { "id": "core" }, "id": "50669554" },
{ "supplier": { "id": "tripadvisor" }, "id": "3166269" },
{ "supplier": { "id": "yelp" }, "id": "6SvL6NOKrknf9aTGK6f2Xw" }
],
"highlights": { "title": [ ], "address": { "label": [ ] } }
}
],
"queryTerms": [ ]
}追加情報
/autosuggestエンドポイントパラメーターの詳細については、「APIリファレンス」を参照してください。
4 日前の更新