HERE Map material comes with different map views and possible overlays like 'Traffic conditions', 'Public transport' and 'Incidents'. I do not want to offer these three views at all. Unfortunately, I was only able to deactivate them by the following code:
//disable traffic information
var control = HEREMap.ui.getControl('mapsettings');
control.getChildren()[1].m[3].setDisabled(true);
control.getChildren()[1].m[2].setDisabled(true);
control.getChildren()[1].m[1].setDisabled(true);
However, this leaves me with gray, unclickable options for like 'Traffic conditions', 'Public transport' and 'Incidents'. Is there a way to show them not at all using the JavaScript API?
Thanks in advance, Team DG7
Not pretty but it works. Follow the same approach to remove the hr.
$(".H_btn:contains('Traffic conditions')").hide();
$(".H_btn:contains('Public transport')").hide();
$(".H_btn:contains('Show traffic incidents')").hide();
As of 8/2018, there does not appear to be any option in the API to create the default UI without the traffic views.
I used the following code to clean up the default menu:
let mapsettings = ui.getControl('mapsettings');
let menuEntries = mapsettings.getChildren()[1].getChildren();
menuEntries[0].getElement().style.borderBottom = 'none';
for (let i=1; i<menuEntries.length; i++)
menuEntries[i].setVisibility(false);
来源:https://stackoverflow.com/questions/45859871/disable-traffic-map-views-with-here-javascript-api