事前定義されたマップフィーチャーを追加する
マップフィーチャーを追加する
HERE SDKでは、マップスキームに加え、MapFeaturesと呼ばれる特殊なレイヤーをサポートしています。これらの機能を使用して、地図上に追加のデータをオーバーレイできます。
MapFeaturesは、さまざまなMapFeatureModesを設定することで、その視覚的な表示を制御できます。たとえば、3Dランドマークはテクスチャあり、またはテクスチャなしのモードで表示できます。ランドマークは、ほとんどのマップスキームでデフォルトで有効になっています。
各MapSchemeでデフォルトで有効になっているMapFeaturesとMapFeatureModesについては、HERE Style Editorドキュメントの「default features and modes per map scheme」(マップスキームごとのデフォルトの機能とモード) を参照してください。
注すべてのライセンスですべての
MapFeaturesを使用できるわけではないことに注意してください。「APIリファレンス」を参照して、お使いのライセンスでサポートされているレイヤーを確認してください。
MapFeaturesを追加すると、パフォーマンスに影響を与える可能性があります。
| フィーチャー | 説明 | Explore | Navigate |
|---|---|---|---|
| AMBIENT_OCCLUSION | 3Dジオメトリー (押出建物とランドマーク) のアンビエントオクルージョン効果。 | はい | はい |
| BUILDING_FOOTPRINTS | 建物の2Dフットプリント。 | はい | はい |
| CONGESTION_ZONES | 渋滞エリア (渋滞課金エリア) として指定されている都市エリアで、当該エリアへの進入には料金が課されます。 | はい | はい |
| CONTOURS | 地図上の等高線を表示または非表示にして、標高の変化を表します。 | いいえ | はい |
| ENVIRONMENTAL_ZONES | 環境ゾーンとしてとして指定されている都市エリアで、当該エリアに進入できる車両の種類が制限されています。 | はい | はい |
| EXTRUDED_BUILDINGS | 建物の簡単な3D表現。 | はい | はい |
| LANDMARKS | 3Dランドマーク。 | いいえ | はい |
| LOW_SPEED_ZONES | 低速ゾーンに指定されている都市エリア。 | はい | はい |
| PUBLIC_TRANSIT | 選択したモードに基づき、地下鉄、トラム、電車、モノレール、フェリーなどの公共交通機関の表示を切り替えます。 | いいえ | はい |
| ROAD_EXIT_LABELS | 道路出口ラベルがある場合、ラベルを表示または非表示にします。 | はい | はい |
| SAFETY_CAMERAS | 安全監視カメラと速度違反取締カメラ。 | いいえ | はい |
| SHADOWS | すべての建物タイプ (押出建物とランドマーク) の影。 | はい | はい |
| TERRAIN | 標高地形図を表示します。 | いいえ | はい |
| TRAFFIC_FLOW | 交通流の速度。 | はい | はい |
| TRAFFIC_INCIDENTS | 交通事案。 | はい | はい |
| VEHICLE_RESTRICTIONS | 車両制限。 | いいえ | はい |
| TRAFFIC_LIGHTS | 信号機。 | はい | はい |
マップフィーチャーレイヤーを有効にする方法を以下に示します。
Map<String, String> mapFeatures = new HashMap<>();
mapFeatures.put(MapFeatures.BUILDING_FOOTPRINTS, MapFeatureModes.BUILDING_FOOTPRINTS_ALL);
mapFeatures.put(MapFeatures.CONTOURS, MapFeatureModes.CONTOURS_ALL); // Only available with the Navigate license.
mapFeatures.put(MapFeatures.CONGESTION_ZONES, MapFeatureModes.CONGESTION_ZONES_ALL);
mapFeatures.put(MapFeatures.ENVIRONMENTAL_ZONES, MapFeatureModes.ENVIRONMENTAL_ZONES_ALL);
mapFeatures.put(MapFeatures.EXTRUDED_BUILDINGS, MapFeatureModes.EXTRUDED_BUILDINGS_ALL);
mapFeatures.put(MapFeatures.LANDMARKS, MapFeatureModes.LANDMARKS_TEXTURED); // Only available with the Navigate license.
mapFeatures.put(MapFeatures.ROAD_EXIT_LABELS, MapFeatureModes.ROAD_EXIT_LABELS_ALL); // Only available with the Navigate license.
mapFeatures.put(MapFeatures.SAFETY_CAMERAS, MapFeatureModes.DEFAULT);
mapFeatures.put(MapFeatures.SHADOWS, MapFeatureModes.SHADOWS_ALL);
mapFeatures.put(MapFeatures.TERRAIN, MapFeatureModes.DEFAULT); // Only available with the Navigate license.
mapFeatures.put(MapFeatures.TRAFFIC_FLOW, MapFeatureModes.DEFAULT);
mapFeatures.put(MapFeatures.TRAFFIC_INCIDENTS, MapFeatureModes.DEFAULT);
mapFeatures.put(MapFeatures.LOW_SPEED_ZONES, MapFeatureModes.LOW_SPEED_ZONES_ALL);
mapFeatures.put(MapFeatures.VEHICLE_RESTRICTIONS, MapFeatureModes.DEFAULT); // Only available with the Navigate license.
mapFeatures.put(MapFeatures.AMBIENT_OCCLUSION, MapFeatureModes.AMBIENT_OCCLUSION_ALL);
mapFeatures.put(MapFeatures.PUBLIC_TRANSIT, MapFeatureModes.PUBLIC_TRANSIT_ALL); // Only available with the Navigate license.
mapView.getMapScene().enableFeatures(mapFeatures);val mapFeatures: MutableMap<String, String> = HashMap()
mapFeatures[MapFeatures.BUILDING_FOOTPRINTS] = MapFeatureModes.BUILDING_FOOTPRINTS_ALL
mapFeatures[MapFeatures.CONTOURS] = MapFeatureModes.CONTOURS_ALL
mapFeatures[MapFeatures.CONGESTION_ZONES] = MapFeatureModes.CONGESTION_ZONES_ALL
mapFeatures[MapFeatures.ENVIRONMENTAL_ZONES] = MapFeatureModes.ENVIRONMENTAL_ZONES_ALL
mapFeatures[MapFeatures.EXTRUDED_BUILDINGS] = MapFeatureModes.EXTRUDED_BUILDINGS_ALL
mapFeatures[MapFeatures.LANDMARKS] = MapFeatureModes.LANDMARKS_TEXTURED
mapFeatures[MapFeatures.ROAD_EXIT_LABELS] = MapFeatureModes.ROAD_EXIT_LABELS_ALL
mapFeatures[MapFeatures.SAFETY_CAMERAS] = MapFeatureModes.DEFAULT
mapFeatures[MapFeatures.SHADOWS] = MapFeatureModes.SHADOWS_ALL
mapFeatures[MapFeatures.TERRAIN] = MapFeatureModes.DEFAULT
mapFeatures[MapFeatures.TRAFFIC_FLOW] = MapFeatureModes.DEFAULT
mapFeatures[MapFeatures.TRAFFIC_INCIDENTS] = MapFeatureModes.DEFAULT
mapFeatures[MapFeatures.LOW_SPEED_ZONES] = MapFeatureModes.LOW_SPEED_ZONES_ALL
mapFeatures[MapFeatures.VEHICLE_RESTRICTIONS] = MapFeatureModes.DEFAULT
mapFeatures[MapFeatures.AMBIENT_OCCLUSION] = MapFeatureModes.AMBIENT_OCCLUSION_ALL
mapFeatures[MapFeatures.PUBLIC_TRANSIT] = MapFeatureModes.PUBLIC_TRANSIT_ALL
mapView!!.mapScene.enableFeatures(mapFeatures)
注新しいマップシーンが読み込まれると (異なるマップスキーム間で切り替える場合など)、以前に設定されたすべてのマップフィーチャーがデフォルト状態にリセットされます。シーンの読み込み操作を行うたびに、目的のマップフィーチャーを再度有効にする必要があります。
新しいレイヤー状態の設定は同期的に実行されますが、事前読み込み済みの有効なマップシーンが必要です。また、新しいマップシーンの読み込み中に新しいフィーチャー状態を設定すると、例外が発生する場合があります。
同様に、次のようにレイヤーのリストを無効にすることもできます。
List<String> mapFeatures = new ArrayList<>();
mapFeatures.add(MapFeatures.TRAFFIC_FLOW);
mapFeatures.add(MapFeatures.TRAFFIC_INCIDENTS);
mapFeatures.add(MapFeatures.EXTRUDED_BUILDINGS);
mapFeatures.add(MapFeatures.AMBIENT_OCCLUSION);
mapView.getMapScene().disableFeatures(mapFeatures);val mapFeatures: MutableList<String> = ArrayList()
mapFeatures.add(MapFeatures.TRAFFIC_FLOW)
mapFeatures.add(MapFeatures.TRAFFIC_INCIDENTS)
mapFeatures.add(MapFeatures.EXTRUDED_BUILDINGS)
mapFeatures.add(MapFeatures.AMBIENT_OCCLUSION)
mapView!!.mapScene.disableFeatures(mapFeatures)
注
TRAFFIC_FLOW機能とTRAFFIC_INCIDENTS機能が有効になると、HERE SDKは新しいベクタータイルごとに新しいトラフィック情報を要求します。これはたとえば、ビューポートのパンやズームで発生します。このため、計画によってはコストが増加する可能性があります。MapContentSettingsを使用すると、交通流と交通事案の更新期間を調整できますが、ビューポートの変更によって上書きされる可能性があります。ターン・バイ・ターンナビ中はこれが1秒間に複数回発生する可能性があり、トラフィックベクタータイルのリクエストが大量に発生する可能性があります。代替策として、TrafficOnRouteを使用して、ルート沿いの交通情報の表示のみを更新することを検討してください。
各マップフィーチャーは、1つ以上の代替レンダリングオプションをサポートしています。Navigateライセンスを使って、たとえば、TERRAINのデフォルトモードであるTERRAIN_HILLSHADEを使用する代わりに、TERRAIN_3Dを使用することで、真の3D地形マップビューで丘陵の地形の陰影を表示できます。
以下に、HERE SDKでサポートされるすべてのマップレイヤーのスクリーンショットを示します。すべてのライセンスですべてのフィーチャーレイヤーが利用できるわけではないことに注意してください。

Screenshots (from left to right): MapFeatures.BUILDING_FOOTPRINTS combined with MapFeatureModes.BUILDING_FOOTPRINTS_ALL shows 2D footprints of buildings. MapFeatures.EXTRUDED_BUILDINGS combined with MapFeatureModes.EXTRUDED_BUILDINGS_ALL shows a 3D representation of buildings. MapFeatures.BUILDING_FOOTPRINTS and MapFeatures.EXTRUDED_BUILDINGS are enabled, by default. This is how it looks when they are disabled.

Screenshots (from left to right): MapFeatures.BUILDING_FOOTPRINTS combined with MapFeatureModes.BUILDING_FOOTPRINTS_ALL shows 2D footprints of buildings. MapFeatures.EXTRUDED_BUILDINGS combined with MapFeatureModes.EXTRUDED_BUILDINGS_ALL shows a 3D representation of buildings. MapFeatures.BUILDING_FOOTPRINTS and MapFeatures.EXTRUDED_BUILDINGS are enabled, by default. This is how it looks when they are disabled.

Screenshots (from left to right): MapFeatures.LANDMARKS combined with MapFeatureModes.LANDMARKS_TEXTURED shows textured landmarks. When paired with MapFeatureModes.LANDMARKS_TEXTURELESS shows textureless landmarks. When paired with MapFeatureModes.LANDMARKS_GRAYSCALE shows landmark textures in grayscale.

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

Screenshots (from left to right): MapFeatures.CONGESTION_ZONES combined with MapFeatureModes.CONGESTION_ZONES_ALL 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.ENVIRONMENTAL_ZONES combined with MapFeatureModes.ENVIRONMENTAL_ZONES_ALL 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.ROAD_EXIT_LABELS combined with the MapFeatureModes.ROAD_EXIT_LABELS_NUMBERS_ONLY shows the road exit labels in numbers. When paired with MapFeatureModes.ROAD_EXIT_LABELS_ALL shows the road exit labels in text (only available with the Navigate license).

Screenshot: MapFeatures.SAFETY_CAMERAS with MapFeatureModes.SAFETY_CAMERAS_ALL shows speed warning cameras.

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

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

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

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

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

Screenshots (from left to right): MapFeatures.VEHICLE_RESTRICTIONS combined with MapFeatureModes.VEHICLE_RESTRICTIONS_ACTIVE shows truck-specific information with only showing active restrictions. When paired with MapFeatureModes.VEHICLE_RESTRICTIONS_ACTIVE_AND_INACTIVE shows truck-specific information with showing active and inactive time-based restrictions. When paired with MapFeatureModes.VEHICLE_RESTRICTIONS_ACTIVE_AND_INACTIVE_DIFFERENTIATED shows truck-specific information with showing active and inactive time-based restrictions, but inactive time-based restrictions are shown as faded (only available with the Navigate license).

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

Screenshot: MapFeatures.PUBLIC_TRANSIT with MapFeatureModes.PUBLIC_TRANSIT_ALL (only available with the Navigate license).

Screenshot: MapFeatures.TRUCK_PREFERRED_ROADS with MapFeatureModes.TRUCK_PREFERRED_ROADS_ALL (only available with the Navigate license).

Screenshot: MapFeatures.TRAFFIC_LIGHTS with MapFeatureModes.TRAFFIC_LIGHTS_ALL
一部のレイヤーでは、MapContentSettings を使用して、表示されているコンテンツを絞り込めます。
MapFeatures.TRAFFIC_INCIDENTS:filterTrafficIncidents(List<TrafficIncidentType> trafficIncidents)を使用して、表示されている交通事案を絞り込めます。MapFeatures.VEHICLE_RESTRICTIONS:configureVehicleRestrictionFilter(TransportMode transportMode, TruckSpecifications truckSpecifications, List<HazardousMaterial> hazardousMaterials, TunnelCategory tunnelCategory)を使用して、表示されているトラックの制約を絞り込めます。
BUILDING_FOOTPRINTSとEXTRUDED_BUILDINGSのマップレイヤーは、MapViewではデフォルトで有効になっています。
ベータリリース:現在は、昼間、夜間、ハイブリッド昼間、ハイブリッド夜間のマップスキームでもMapFeatureModes.TERRAIN_3Dをサポートしています (Navigateライセンスでのみ使用可能)。

Screenshots (from left to right): MapScheme.DAY with MapFeatureModes.TERRAIN_3D, MapScheme.NIGHT with MapFeatureModes.TERRAIN_3D, MapScheme.HYBRID_DAY with MapFeatureModes.TERRAIN_3D, MapScheme.HYBRID_NIGHT with MapFeatureModes.TERRAIN_3D (only available with the Navigate license).
押出建物のカバレージ
MapFeatures.EXTRUDED_BUILDINGS フィーチャーが有効になっている場合、建物はアウトライン付きの 3D でレンダリングされます。建物の外観は国によって異なる場合があります。たとえば、日本ではアウトラインが色付きの建物の壁と組み合わされることがあります。
デフォルトでは、押出建物はほとんどの国でサポートされています。
詳細な日本地図は、別途 HERE との契約が必要となります。

Screenshots (from left to right): Extruded buildings for a non-Japan region, extruded buildings for the Japan map.
MapFeaturesサンプルアプリを試す
上記のコードスニペットのほとんどは、「MapFeatures」サンプルアプリ (Java版とKotlin版) で利用できます。このサンプルアプリは、GitHubでお好みのプラットフォームのものを見つけることができます。
2 か月前の更新