MapContentSettings (API Reference)
Class MapContentSettings
Provides settings regarding map data which are applied globally to all map views. The settings can already be changed before a map view instance is created.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumTraffic refresh period error codestatic final classTraffic refresh period error exception -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconfigureVehicleRestrictionFilter(TransportMode transportMode, TruckSpecifications truckSpecifications, List<HazardousMaterial> hazardousMaterials, TunnelCategory tunnelCategory) Deprecated.static voidconfigureVehicleRestrictionFilter(TransportSpecification transportSpecs) Configures a filter forMapFeatures.VEHICLE_RESTRICTIONSto show only the restrictions matching the transport specifications when the feature is enabled.static voidfilterTrafficIncidents(List<TrafficIncidentType> trafficIncidents) Filters the displayed traffic incidents so that only the ones applicable to the specified criteria are shown when general display of traffic incidents is enabled.static voidResets POI categories visibility to their default state.static voidRemoves all filters regarding Traffic Incidents so that all incidents will be displayed, when the display of Traffic Incidents is enabled usingMapScene.enableFeatures(java.util.Map<java.lang.String, java.lang.String>)withMapFeatures.TRAFFIC_INCIDENTS.static voidResets the traffic data (both flow and incidents) refresh period so the default traffic information validity time and the refresh period derived from the refresh period of the traffic server is used.static voidRemoves all filters regarding vehicle restrictions so that all restrictions will be displayed, when the display of vehicle restrictions is enabled by enabling feature usingMapScene.enableFeatures(java.util.Map<java.lang.String, java.lang.String>)withMapFeatures.VEHICLE_RESTRICTIONSand setting layer visibility usingMapScene.setLayerVisibility(java.lang.String, com.here.sdk.mapview.VisibilityState).static voidsetPoiCategoriesVisibility(List<String> categoryIds, VisibilityState visibility) Sets visibility for embedded carto POI categories (points of interest that are visible on the map, by default).static voidsetTrafficRefreshPeriod(Duration value) Sets the traffic data refresh period for bothMapFeatures.TRAFFIC_FLOWandMapFeatures.TRAFFIC_INCIDENTS.
-
Method Details
-
configureVehicleRestrictionFilter
@Deprecated public static void configureVehicleRestrictionFilter(@NonNull TransportMode transportMode, @NonNull TruckSpecifications truckSpecifications, @Nullable List<HazardousMaterial> hazardousMaterials, @Nullable TunnelCategory tunnelCategory) Deprecated.Will be removed in v4.28.0, use
configureVehicleRestrictionFilter(TransportSpecification)instead.Configure a filter for
MapFeatures.VEHICLE_RESTRICTIONSto show only the restrictions matching the specified criteria when the feature is enabled.Filtering rules for truck specifications
Only restrictions applicable to the supplied truck specifications will be shown.
Examples:
- If the height in
truckSpecificationsis set to 200 cm, then height restrictions with a height greater than 200 cm will not be displayed. - If the trailer count in
truckSpecificationsis set to 2, then trailer restrictions for a count greater than 2 will not be displayed.
Filtering rules for hazardous materials
Only restrictions applicable to specified hazardous materials will be shown. If at least one hazardous material of any type is present in the list, all available tunnel category restrictions will be displayed. In order to filter-out non-applicable tunnel categories, a tunnel category, that applies to the vehicle, can be specified additionally.
Examples:
- If the
hazardousMaterialscontainsHazardousMaterial.POISONandHazardousMaterial.GAS, then only material restrictions for poison and gas will be displayed. - If the
hazardousMaterialslist is empty, then no material restrictions will be shown. - If the
hazardousMaterialslist is not supplied at all (isnull), then no material restrictions will be shown. - If the
hazardousMaterialscontains at least one hazardous material of any type andtunnelCategoryisnull, then only corresponding material restrictions will be displayed together with all available tunnel categories.
Filtering rules for tunnel category
Tunnel categories are labeled and rated based on the level of restriction they provide. The lowest level of restriction is
TunnelCategory.B, the highest and most restrictive one isTunnelCategory.E.Specifying tunnel category means that:
- The truck carries goods which could cause only the additional dangerous effects described in specified tunnel category and other categories below it with lower level of restriction.
- The truck does not carry goods that could cause the dangerous effects described in tunnel categories above with higher restriction levels than the one specified.
Tunnel categories are closely related to hazardous materials.
Since the type of hazardous material alone does not define the exact level of danger, to ensure comprehensive coverage; the HERE SDK follows:
- If at least one hazardous material is specified but no
tunnelCategoryis provided, the SDK enables and displays all tunnel category restrictions to ensure that no relevant restrictions are omitted. - If both hazardous materials and a
tunnelCategoryare specified, the SDK strictly follows the given tunnel category parameter and displays only the applicable restrictions.
Example: If
tunnelCategoryis set toTunnelCategory.D, then restrictions for tunnel categoryTunnelCategory.EandTunnelCategory.Dwill be displayed, but not the categoriesTunnelCategory.BandTunnelCategory.C.- Parameters:
transportMode-Specifies the current transport type. Currently, it's used to distinguish between truck and other transport modes. This distinction ensures consistency between the routing logic and the information displayed on the map. At present, this is primarily used to suppress the generic truck restriction icon.
truckSpecifications-The size, weight, type and trailer count specifications to filter for, so that only restrictions which are relevant for the given specifications are displayed.
hazardousMaterials-The hazardous materials to filter for, so that only applicable restrictions are displayed. When the list is
nullor empty, then no material restrictions will be displayed.tunnelCategory-The tunnel category to filter for, so that only applicable restrictions are displayed. If
null, then no tunnel category restrictions will be displayed.
- If the height in
-
configureVehicleRestrictionFilter
public static void configureVehicleRestrictionFilter(@NonNull TransportSpecification transportSpecs) Configures a filter for
MapFeatures.VEHICLE_RESTRICTIONSto show only the restrictions matching the transport specifications when the feature is enabled.This method provides a unified way to configure vehicle restriction filters using a single
TransportSpecificationparameter. This allows you to use the same transport configuration for both routing and map rendering, ensuring consistency between route calculation and the restrictions displayed on the map.The method extracts the transport mode, vehicle specifications, hazardous materials, and tunnel category from the
transportSpecsparameter and applies filtering according to the same rules described below.Filtering rules for transport mode
The transport mode is used to distinguish between truck and other transport modes. This distinction ensures consistency between the routing logic and the information displayed on the map. At present, this is primarily used to suppress the generic truck restriction icon for non-truck modes.
Currently, only vehicle-related restrictions are supported. For pedestrian, scooter, or taxi transport modes, the transport mode information is used, but no additional vehicle-specific restrictions are applied.
Filtering rules for vehicle specifications
Only restrictions applicable to the vehicle specifications will be shown. The vehicle specifications include dimensions (height, width, length), weights (gross weight, weight per axle), and trailer count.
Examples:
- If the height in vehicle specifications is set to 200 cm, then height restrictions with a height greater than 200 cm will not be displayed.
- If the trailer count in vehicle specifications is set to 2, then trailer restrictions for a count greater than 2 will not be displayed.
Filtering rules for hazardous materials
Only restrictions applicable to specified hazardous materials will be shown. Hazardous materials are specified within the
VehicleSpecificationcontained in thetransportSpecsparameter.If at least one hazardous material of any type is present in the list, all available tunnel category restrictions will be displayed. In order to filter-out non-applicable tunnel categories, a tunnel category that applies to the vehicle can be specified additionally.
Examples:
- If the hazardous materials list contains
HazardousMaterial.POISONandHazardousMaterial.GAS, then only material restrictions for poison and gas will be displayed. - If the hazardous materials list is empty, then no material restrictions will be shown.
- If the hazardous materials list is not supplied at all (is
null), then no material restrictions will be shown. - If the hazardous materials list contains at least one hazardous material of any
type and tunnel category is
null, then only corresponding material restrictions will be displayed together with all available tunnel categories.
Filtering rules for tunnel category
Tunnel categories are labeled and rated based on the level of restriction they provide. The lowest level of restriction is
TunnelCategory.B, the highest and most restrictive one isTunnelCategory.E.The tunnel category is specified within the
VehicleSpecificationcontained in thetransportSpecsparameter.Specifying tunnel category means that:
- The vehicle carries goods which could cause only the additional dangerous effects described in specified tunnel category and other categories below it with lower level of restriction.
- The vehicle does not carry goods that could cause the dangerous effects described in tunnel categories above with higher restriction levels than the one specified.
Tunnel categories are closely related to hazardous materials.
Since the type of hazardous material alone does not define the exact level of danger, to ensure comprehensive coverage; the HERE SDK follows:
- If at least one hazardous material is specified but no tunnel category is provided, the SDK enables and displays all tunnel category restrictions to ensure that no relevant restrictions are omitted.
- If both hazardous materials and a tunnel category are specified, the SDK strictly follows the given tunnel category parameter and displays only the applicable restrictions.
Example: If tunnel category is set to
TunnelCategory.D, then restrictions for tunnel categoryTunnelCategory.EandTunnelCategory.Dwill be displayed, but not the categoriesTunnelCategory.BandTunnelCategory.C.- Parameters:
transportSpecs-The transport specification containing the transport mode and vehicle specifications. For vehicle modes (car, truck, bus), the
VehicleSpecificationwithin this parameter provides dimensions, weights, hazardous materials, and tunnel category information used for filtering. The sameTransportSpecificationobject can be used for both routing configuration and map rendering to ensure consistency.
-
resetVehicleRestrictionFilter
public static void resetVehicleRestrictionFilter()Removes all filters regarding vehicle restrictions so that all restrictions will be displayed, when the display of vehicle restrictions is enabled by enabling feature using
MapScene.enableFeatures(java.util.Map<java.lang.String, java.lang.String>)withMapFeatures.VEHICLE_RESTRICTIONSand setting layer visibility usingMapScene.setLayerVisibility(java.lang.String, com.here.sdk.mapview.VisibilityState). -
setPoiCategoriesVisibility
public static void setPoiCategoriesVisibility(@NonNull List<String> categoryIds, @NonNull VisibilityState visibility) Sets visibility for embedded carto POI categories (points of interest that are visible on the map, by default). For HERE standard map schemes all available POI categories are visible by default for each selected map scheme. Note that not all POI categories are available for all map schemes.
Based on the given list of categories the number of shown carto POIs can be reduced. To find all possible POI category strings look into
here.sdk.search.PlaceCategory. Note that it is enough to hide a main category like "100" (eat-and-drink) to also affect sub categories such as "100-1000" (eat-and-drink-restaurant) and "100-1100" (eat-and-drink-coffee-tea). To enable a sub category, also the related main categories need have theVISIBLEstate.The POI visibility is a property of the map data itself. Once set it will be applied to all HERE standard map schemes and the selected categories will remain even when switching a map scheme.
- Parameters:
categoryIds-A list of POI categories that a visibility state is set for.
visibility-A selected visibility for specified POI categories.
-
resetPoiCategoriesVisibility
public static void resetPoiCategoriesVisibility()Resets POI categories visibility to their default state.
-
filterTrafficIncidents
Filters the displayed traffic incidents so that only the ones applicable to the specified criteria are shown when general display of traffic incidents is enabled. The display of traffic incidents can be enabled using
MapScene.enableFeatures(java.util.Map<java.lang.String, java.lang.String>)withMapFeatures.TRAFFIC_INCIDENTS.- Parameters:
trafficIncidents-The traffic incidents to filter for, so that only applicable incidents are displayed. When the list is empty, then all traffic incidents will be displayed. If the
trafficIncidentscontainsTrafficIncidentType.UNKNOWN, then the traffic filter will be applied ignoring this element.
-
resetTrafficIncidentFilter
public static void resetTrafficIncidentFilter()Removes all filters regarding Traffic Incidents so that all incidents will be displayed, when the display of Traffic Incidents is enabled using
MapScene.enableFeatures(java.util.Map<java.lang.String, java.lang.String>)withMapFeatures.TRAFFIC_INCIDENTS. -
setTrafficRefreshPeriod
public static void setTrafficRefreshPeriod(@NonNull Duration value) throws MapContentSettings.TrafficRefreshPeriodException Sets the traffic data refresh period for both
MapFeatures.TRAFFIC_FLOWandMapFeatures.TRAFFIC_INCIDENTS. By default, the traffic information validity time and the refresh period is derived from the refresh period of HERE's traffic server. The period set by this function will override the server's default setting for upcoming traffic data requests. Defaults to 60 seconds.- Parameters:
value-Traffic data refresh period in seconds. Valid range is [60, 300] seconds. The shortest refresh period that can be set is 60 seconds. This means that the traffic data shown on a map view will be refreshed every minute. The longest refresh period that can be set is 300 seconds. This means that the traffic data shown on the current map view will be refreshed every 5 minutes if the viewport does not change. Note that when a viewport change occurs, new traffic data may be requested regardless of the set refresh period. For example, during turn-by-turn navigation, frequent viewport changes can result in missing traffic data, causing new requests to be made more often.
- Throws:
MapContentSettings.TrafficRefreshPeriodException-MapContentSettings.TrafficRefreshPeriodExceptionindicates what went wrong.
-
resetTrafficRefreshPeriod
public static void resetTrafficRefreshPeriod()Resets the traffic data (both flow and incidents) refresh period so the default traffic information validity time and the refresh period derived from the refresh period of the traffic server is used.
-
configureVehicleRestrictionFilter(TransportSpecification)instead.