ガイド変更履歴HERE SDK API references
ガイド

事前定義されたマップフィーチャーを追加する

マップフィーチャーを追加する

HERE SDKでは、マップスキームに加え、MapFeaturesと呼ばれる特殊なレイヤーをサポートしています。これらの機能を使用して、地図上に追加のデータをオーバーレイできます。

MapFeaturesは、さまざまなMapFeatureModesを設定することで、その視覚的な表示を制御できます。たとえば、3Dランドマークはテクスチャあり、またはテクスチャなしのモードで表示できます。ランドマークは、ほとんどのマップスキームでデフォルトで有効になっています。

MapSchemeでデフォルトで有効になっているMapFeaturesMapFeatureModesについては、HERE Style Editorドキュメントの「default features and modes per map scheme」(マップスキームごとのデフォルトの機能とモード) を参照してください。

すべてのライセンスですべてのMapFeaturesを使用できるわけではないことに注意してください。「APIリファレンス」を参照して、お使いのライセンスでサポートされているレイヤーを確認してください。

MapFeaturesを追加すると、パフォーマンスに影響を与える可能性があります。

フィーチャー 説明 Explore Navigate
ambientOcclusion 3Dジオメトリー (押出建物とランドマーク) のアンビエントオクルージョン効果。 はい はい
buildingFootprints 建物の2Dフットプリント。 はい はい
congestionZones 渋滞エリア (渋滞課金エリア) として指定されている都市エリアで、当該エリアへの進入には料金が課されます。 はい はい
contours 地図上の等高線を表示または非表示にして、標高の変化を表します。 いいえ はい
environmentalZones 環境ゾーンとしてとして指定されている都市エリアで、当該エリアに進入できる車両の種類が制限されています。 はい はい
extrudedBuildings 建物の簡単な3D表現。 はい はい
landmarks 3Dランドマーク。 いいえ はい
lowSpeedZones 低速ゾーンに指定されている都市エリア。 はい はい
publicTransit 選択したモードに基づき、地下鉄、トラム、電車、モノレール、フェリーなどの公共交通機関の表示を切り替えます。 いいえ はい
roadExitLabels 道路出口ラベルがある場合、ラベルを表示または非表示にします。 はい はい
safetyCameras 安全監視カメラと速度違反取締カメラ。 いいえ はい
shadows すべての建物タイプ (押出建物とランドマーク) の影。 はい はい
terrain 標高地形図を表示します。 いいえ はい
trafficFlow 交通流の速度。 はい はい
trafficIncidents 交通事案。 はい はい
vehicleRestrictions 車両制限。 いいえ はい
trafficLights 信号機。 はい はい

マップフィーチャーレイヤーを有効にする方法を以下に示します。

mapView.mapScene.enableFeatures([MapFeatures.buildingFootprints : MapFeatureModes.buildingFootprintsAll]);
mapView.mapScene.enableFeatures([MapFeatures.contours : MapFeatureModes.contoursAll]); // Only available with the Navigate license.
mapView.mapScene.enableFeatures([MapFeatures.congestionZones : MapFeatureModes.congestionZonesAll]);
mapView.mapScene.enableFeatures([MapFeatures.environmentalZones : MapFeatureModes.environmentalZonesAll]);
mapView.mapScene.enableFeatures([MapFeatures.extrudedBuildings : MapFeatureModes.defaultMode]);
mapView.mapScene.enableFeatures([MapFeatures.landmarks : MapFeatureModes.landmarksTextured]); // Only available with the Navigate license.
mapView.mapScene.enableFeatures([MapFeatures.roadExitLabels : MapFeatureModes.roadExitLabelsAll]); // Only available with the Navigate license.
mapView.mapScene.enableFeatures([MapFeatures.safetyCameras : MapFeatureModes.defaultMode]);
mapView.mapScene.enableFeatures([MapFeatures.shadows : MapFeatureModes.shadowsAll]);
mapView.mapScene.enableFeatures([MapFeatures.terrain : MapFeatureModes.defaultMode]);
mapView.mapScene.enableFeatures([MapFeatures.trafficFlow : MapFeatureModes.defaultMode]); // Only available with the Navigate license.
mapView.mapScene.enableFeatures([MapFeatures.trafficIncidents : MapFeatureModes.defaultMode]);
mapView.mapScene.enableFeatures([MapFeatures.lowSpeedZones : MapFeatureModes.lowSpeedZonesAll]);
mapView.mapScene.enableFeatures([MapFeatures.vehicleRestrictions : MapFeatureModes.defaultMode]); // Only available with the Navigate license.
mapView.mapScene.enableFeatures([MapFeatures.ambientOcclusion : MapFeatureModes.ambientOcclusionAll]);
mapView.mapScene.enableFeatures([MapFeatures.publicTransit : MapFeatureModes.publicTransitAll]); // Only available with the Navigate license.

新しいマップシーンが読み込まれると (異なるマップスキーム間で切り替える場合など)、以前に設定されたすべてのマップフィーチャーがデフォルト状態にリセットされます。シーンの読み込み操作を行うたびに、目的のマップフィーチャーを再度有効にする必要があります。

新しいレイヤー状態の設定は同期的に実行されますが、事前読み込み済みの有効なマップシーンが必要です。また、新しいマップシーンの読み込み中に新しいフィーチャー状態を設定すると、例外が発生する場合があります。

同様に、次のようにレイヤーのリストを無効にすることもできます。

mapView.mapScene.disableFeatures([MapFeatures.buildingFootprints,
                                  MapFeatures.extrudedBuildings,
                                  MapFeatures.ambientOcclusion])

trafficFlow機能とtrafficIncidents機能が有効になると、HERE SDKは新しいベクタータイルごとに新しいトラフィック情報を要求します。これはたとえば、ビューポートのパンやズームで発生します。このため、計画によってはコストが増加する可能性があります。MapContentSettingsを使用すると、交通流と交通事案の更新期間を調整できますが、ビューポートの変更によって上書きされる可能性があります。ターン・バイ・ターンナビ中はこれが1秒間に複数回発生する可能性があり、トラフィックベクタータイルのリクエストが大量に発生する可能性があります。代替策として、TrafficOnRouteを使用して、ルート沿いの交通情報の表示のみを更新することを検討してください。

各マップフィーチャーは、1つ以上の代替レンダリングオプションをサポートしています。たとえば、terrainのデフォルトモードであるterrainHillshadeを使用する代わりに、terrain3dを使用することで、真の3D地形マップビューで丘陵の地形の陰影を表示できます。

以下に、HERE SDKでサポートされるすべてのマップレイヤーのスクリーンショットを示します。すべてのライセンスですべてのフィーチャーレイヤーが利用できるわけではないことに注意してください。

一部のレイヤーでは、MapContentSettings を使用して、表示されているコンテンツを絞り込めます。

  • MapFeatures.trafficIncidentsfilterTrafficIncidents​(trafficIncidents: [TrafficIncidentType]) を使用して、表示されている交通事案を絞り込めます。
  • MapFeatures.vehicleRestrictionsconfigureVehicleRestrictionFilter(transportMode: TransportMode, truckSpecifications: TruckSpecifications, hazardousMaterials: [HazardousMaterial]?, tunnelCategory: TunnelCategory?) を使用して、表示されているトラックの制約を絞り込めます。

buildingFootprintsextrudedBuildings のマップ レイヤーは、MapView ではデフォルトで有効になっています。

ベータ リリース:現在は、昼間、夜間、ハイブリッド昼間、ハイブリッド夜間のマップ スキームでも MapFeatureModes.terrain3d をサポートしています。

押出建物のカバレージ

MapFeatures.extrudedBuildings フィーチャーが有効になっている場合、建物はアウトライン付きの 3D でレンダリングされます。建物の外観は国によって異なる場合があります。たとえば、日本ではアウトラインが色付きの建物の壁と組み合わされることがあります。

デフォルトでは、押出建物はほとんどの国でサポートされています。

詳細な日本地図は、別途 HERE との契約が必要となります。

建物の影を有効にする

HERE SDKでは、建物の影のレンダリングがサポートされています。これは、衛星写真ベース以外のマップスキームでのみ使用できます。MapViewの影を有効にするには、以下を使用します。

mapFeatures[MapFeatures.shadows] = MapFeatureModes.shadowsAll

// Sets the desired shadow quality for all instances of MapView.
MapView.shadowQuality = ShadowQuality.veryHigh
mapScene.enableFeatures(mapFeatures)

影品質が設定されていない場合、この機能は効果を持たず、影はレンダリングされません。影を有効にするとパフォーマンスに影響するため、十分な性能を持つデバイスでのみ使用してください。ハードウェア設定でパフォーマンスの問題が発生した場合は、ShadowQualityを下げてください。


EN 日本語

HERE documentation

Find answers to your product and technical questions

Documentation

What's new

Videos

EN 日本語

HERE ドキュメント

製品や技術に関する質問の答えを見つけましょう。より多くの内容と最新の情報については、英語版をご覧ください。

ドキュメント

ダイナミックマップ

動的コンテンツ関連のAPIをアプリやサービスに活用して、ドライバーが安全・快適かつ予定どおりに目的地へ到着できるよう支援します。

地図とデータ

世界中を走行する多数のマッピング車両から得られる最新の位置情報データを活用し、精度の高い地図やカスタムレイヤーを構築できます。

最新情報

動画

(function () { const input = document.querySelector('input[data-typeahead]'); if (!input) return; // Prevent the form from submitting/navigating input.closest('form')?.addEventListener('submit', e => e.preventDefault()); input.addEventListener('input', function () { const q = this.value.trim().toLowerCase(); document.querySelectorAll('.nav-group-name').forEach(group => { let anyVisible = false; group.querySelectorAll('.nav-group-task').forEach(task => { const text = task.textContent.trim().toLowerCase(); const show = !q || text.includes(q); task.style.display = show ? '' : 'none'; if (show) anyVisible = true; }); // Hide the whole group header if nothing matches group.style.display = anyVisible || !q ? '' : 'none'; }); }); })(); (function () { function onTokenClick(event) { var link = event.target.closest('.sdk-for-ios .item .token'); if (!link) return; event.preventDefault(); console.log('token clicked', link.textContent.trim()); var item = link.closest('.item'); if (!item) return; var content = item.querySelector('.height-container'); if (!content) { console.log('no .height-container found for item', item); return; } var isHidden = window.getComputedStyle(content).display === 'none'; content.style.display = isHidden ? 'block' : 'none'; link.classList.toggle('token-open', isHidden); var href = link.getAttribute('href'); if (href) { if (history.pushState) history.pushState({}, '', href); else location.hash = href; } } function openHashTarget() { var hash = window.location.hash.slice(1); if (!hash) return; var anchor = document.querySelector('.sdk-for-ios a[name="' + hash + '"]'); if (!anchor) return; var item = anchor.closest('.item'); if (!item) return; var link = item.querySelector('.token'); var content = item.querySelector('.height-container'); if (!link || !content) return; content.style.display = 'block'; link.classList.add('token-open'); } function init() { console.log('HERE SDK accordion init'); openHashTarget(); } document.removeEventListener('click', onTokenClick); document.addEventListener('click', onTokenClick); if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); } window.addEventListener('hashchange', openHashTarget); window.addEventListener('pageLoad', init); })();