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

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

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

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

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

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

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

フィーチャー説明ExploreNavigate
ambientOcclusion3Dジオメトリー (押出建物とランドマーク) のアンビエントオクルージョン効果。はいはい
buildingFootprints建物の2Dフットプリント。はいはい
congestionZones渋滞エリア (渋滞課金エリア) として指定されている都市エリアで、当該エリアへの進入には料金が課されます。はいはい
contours地図上の等高線を表示または非表示にして、標高の変化を表します。いいえはい
environmentalZones環境ゾーンとしてとして指定されている都市エリアで、当該エリアに進入できる車両の種類が制限されています。はいはい
extrudedBuildings建物の簡単な3D表現。はいはい
landmarks3Dランドマーク。いいえはい
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でサポートされるすべてのマップレイヤーのスクリーンショットを示します。すべてのライセンスですべてのフィーチャーレイヤーが利用できるわけではないことに注意してください。

Screenshots (from left to right): MapFeatures.buildingFootprints combined with MapFeatureModes.buildingFootprintsAll shows 2D footprints of buildings. MapFeatures.extrudedBuildings combined with MapFeatureModes.extrudedBuildingsAll shows a 3D representation of buildings. MapFeatures.buildingFootprints and MapFeatures.extrudedBuildings are enabled by default. This is how it looks when they are disabled.

Screenshots (from left to right): MapFeatures.landmarks combined with MapFeatureModes.landmarksTextured shows textured landmarks. When paired with MapFeatureModes.landmarksTextureless shows textureless landmarks. When paired with MapFeatureModes.landmarksGrayscale shows landmark textures in grayscale.

Screenshot: MapFeatures.contours with MapFeatureModes.contoursAll shows contour lines on the map to represent elevation changes. (only available with the Navigate license)

Screenshots (from left to right): MapFeatures.congestionZones combined with MapFeatureModes.congestionZonesAll shows city areas designated as congestion charge zones, marked as purple shade (Congestion charging zones are area where drivers are required to pay a fee to enter or travel within). MapFeatures.environmentalZones combined with MapFeatureModes.environmentalZonesAll shows city areas designated as environmental zones, marked as teal shade (Environmental zones are low emission zone, a designated area in a city or region where access for certain vehicles is restricted).

Screenshots (from left to right): MapFeatures.roadExitLabels combined with the MapFeatureModes.roadExitLabelsNumbersOnly shows the road exit labels in numbers. When paired with MapFeatureModes.roadExitLabelsAll shows the road exit labels in text.

Screenshot: MapFeatures.safetyCameras with MapFeatureModes.safetyCamerasAll shows speed warning cameras.

Screenshot: MapFeatures.shadows with MapFeatureModes.shadowsAll shows shadow for all building types (extruded buildings and landmarks).

Screenshot: MapFeatures.terrain with MapFeatureModes.terrainHillshade shows topographical shading for hills. (only available with the Navigate license)

Screenshot: MapFeatures.terrain with MapFeatureModes.terrain3d shows topographical shading for hills on a 3D terrain map. (only available with the Navigate license)

Screenshots (from left to right): MapFeatures.trafficFlow combined with MapFeatureModes.trafficFlowWithFreeFlow shows active traffic jams on the streets by showing green lines when there is no traffic congestion. When paired with MapFeatureModes.trafficFlowWithoutFreeFlow, no green lines are shown when there is no traffic congestion. When paired with MapFeatureModes.trafficFlowJapanWithoutFreeFlow, no green lines are shown when there is no traffic congestion.

Screenshot: MapFeatures.trafficIncidents with MapFeatureModes.trafficIncidentsAll shows incidents such as accidents, construction works, and more.

Screenshots (from left to right): MapFeatures.vehicleRestrictions combined with MapFeatureModes.vehicleRestrictionsActive shows truck-specific information with only showing active restrictions. When paired with MapFeatureModes.vehicleRestrictionsActiveAndInactive shows truck-specific information with showing active and inactive time-based restrictions. When paired with MapFeatureModes.vehicleRestrictionsActiveAndInactiveDifferentiated shows truck-specific information with showing active and inactive time-based restrictions, but inactive time-based restrictions are shown as faded.

Screenshot (from left to right): On the left, ambient occlusion is disabled, while on the right, ambient occlusion is enabled using MapFeatures.ambientOcclusion with MapFeatureModes.ambientOcclusionAll, showcasing the enhanced shadowing and depth effects.

Screenshot: MapFeatures.publicTransit with MapFeatureModes.publicTransitAll. (only available with the Navigate license)

Screenshot: MapFeatures.truckPreferredRoads with MapFeatureModes.truckPreferredRoadsAll (only available with the Navigate license).

Screenshot: MapFeatures.trafficLights with MapFeatureModes.trafficLightsAll

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

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

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

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

Screenshots (from left to right): MapScheme.day with MapFeatureModes.terrain3d, MapScheme.night with MapFeatureModes.terrain3d, MapScheme.hybridDay with MapFeatureModes.terrain3d, MapScheme.hybridNight with MapFeatureModes.terrain3d. (only available with the Navigate license)

押出建物のカバレージ

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

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

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

Screenshots (from left to right): Extruded buildings for a non-Japan region, extruded buildings for the Japan map.

建物の影を有効にする

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を下げてください。


このページは役に立ちましたか?