Add predefined map features
Add map features
In addition to map schemes, the HERE SDK supports specialized layers called MapFeatures. These features allow you to overlay additional data on the map.
MapFeatures can be configured with different MapFeatureModes to control its visual appearance. For example, 3D landmarks can be displayed using textured or non-textured modes. Landmarks are enabled by default for most map schemes.
To see which MapFeatures and MapFeatureModes are enabled by default for each MapScheme, refer to default features and modes per map scheme in the HERE Style Editor documentation.
NoteNote that not all
MapFeaturesare available for all licenses. Take a look at the API Reference to know which layers are supported for your licence.Adding
MapFeaturesmay have a performance impact.
| Feature | Description | In Explore | In Navigate |
|---|---|---|---|
| ambientOcclusion | Ambient occlusion effect for 3D geometries (extruded buildings and landmarks). | Yes | Yes |
| buildingFootprints | The 2D footprint of buildings. | Yes | Yes |
| congestionZones | City areas designated as congestion zones (or congestion charge zones), which impose fees on entering such areas. | Yes | Yes |
| contours | Show or hide contour lines on the map to represent elevation changes. | No | Yes |
| environmentalZones | City areas designated as environmental zones, which empose limitations on the type of vehicles that are allowed to enter such areas. | Yes | Yes |
| extrudedBuildings | Simple 3D representation of buildings. | Yes | Yes |
| landmarks | 3D landmarks. | No | Yes |
| lowSpeedZones | City areas designated as low speed zones. | Yes | Yes |
| publicTransit | Toggles the display of public transit lines for systems like subway, tram, train, monorail, and ferry, based on the selected mode. | No | Yes |
| roadExitLabels | Show or hide road exit labels, if available. | Yes | Yes |
| safetyCameras | Safety and speed cameras. | No | Yes |
| shadows | Shadows for all building types (extruded buildings and landmarks). | Yes | Yes |
| terrain | Show elevation topography. | No | Yes |
| trafficFlow | Traffic flow speed. | Yes | Yes |
| trafficIncidents | Traffic incidents. | Yes | Yes |
| vehicleRestrictions | Vehicle restrictions. | No | Yes |
| trafficLights | Traffic lights. | Yes | Yes |
Below you can see how the map feature layers can be enabled:
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.
NoteWhen a new map scene is loaded (for example, when switching between different map schemes), all previously configured map features are reset to their default state. You must re-enable your desired map features after each scene load operation.
Setting a new layer state is performed synchronously, but it requires a valid map scene that must have been loaded before. Also, setting a new feature state while a new map scene is being loaded, may result in an exception.
Similarly, you can also disable a list of layers like shown below:
mapView.mapScene.disableFeatures([MapFeatures.buildingFootprints,
MapFeatures.extrudedBuildings,
MapFeatures.ambientOcclusion])
NoteWhen
trafficFlowandtrafficIncidentsfeatures are enabled, then the HERE SDK will request new traffic information for each new vector tile - for example, by panning the viewport or zooming. This may lead to an increase of costs, depending on your plan. WithMapContentSettingsthe traffic flow and incident refresh period can be adjusted, but this can be overwritten by viewport changes. During turn-by-turn navigation, this can happen multiple times per second and may result in a high number of Traffic Vector Tile requests. As an alternative, consider using TrafficOnRoute to update only the traffic visualization along the route itself.
Each map feature supports one or more alternative rendering options. For example, instead of using terrainHillshade, which is the default mode for terrain, you can use terrain3d to show advanced topographical shading for hills on a true 3D terrain map view.
Below you can see screenshots for all map layers supported by the HERE SDK - note that not all feature layers are available for all licenses:
Some layers allow to filter the shown content via MapContentSettings:
MapFeatures.trafficIncidents: UsefilterTrafficIncidents(trafficIncidents: [TrafficIncidentType])to filter the displayed traffic incidents.MapFeatures.vehicleRestrictions: UseconfigureVehicleRestrictionFilter(transportMode: TransportMode, truckSpecifications: TruckSpecifications, hazardousMaterials: [HazardousMaterial]?, tunnelCategory: TunnelCategory?)to filter the displayed truck restrictions.
The map layers buildingFootprints & extrudedBuildings are enabled by default on the MapView.
Beta Release: we now also support MapFeatureModes.terrain3d with day, night, hybrid day and hybrid night map schemes.
Extruded buildings coverage
When the MapFeatures.extrudedBuildings feature is enabled, buildings will be rendered in 3D with an outline. The appearance of the buildings may vary by country. For example, in Japan, the outlines are combined sometimes with colored building walls.
By default, extruded buildings are supported for most countries.
Note that the enriched Japan map requires a separate contract with HERE.
Enable building shadows
The HERE SDK supports rendering building shadows, available only with non-satellite-based map schemes. To enable shadows for a MapView, use the following:
mapFeatures[MapFeatures.shadows] = MapFeatureModes.shadowsAll
// Sets the desired shadow quality for all instances of MapView.
MapView.shadowQuality = ShadowQuality.veryHigh
mapScene.enableFeatures(mapFeatures)
If no shadow quality is configured, the feature has no effect and shadows are not rendered. Enabling shadows impacts performance and should be used only on devices with sufficient capability. Reduce the ShadowQuality if performance issues occur on your hardware setup.
Updated 4 hours ago