Google maps 如何删除地图的左上角按钮?
默认情况下,地图左上角有两个按钮plan和satellite: 以下是代码:Google maps 如何删除地图的左上角按钮?,google-maps,google-maps-api-3,Google Maps,Google Maps Api 3,默认情况下,地图左上角有两个按钮plan和satellite: 以下是代码: <script> map = null; poly = null; function initMap() { var directionsDisplay = new google.maps.DirectionsRenderer; var directionsService = new google.maps.DirectionsService; map = new google.map
<script>
map = null;
poly = null;
function initMap() {
var directionsDisplay = new google.maps.DirectionsRenderer;
var directionsService = new google.maps.DirectionsService;
map = new google.maps.Map(document.getElementById('map'), {
zoom: 7,
center: {lat: -18.92379, lng: 47.542537},
mapTypeId: google.maps.MapTypeId.ROADMAP
}
);
directionsDisplay.setMap(map);
poly = new google.maps.Polyline({
strokeColor: '#000000',
strokeOpacity: 1.0,
strokeWeight: 3
});
poly.setMap(map);
document.getElementById('organisation').addEventListener('change', function() {
getFlotteByOrganisation(document.getElementById('organisation').value);
});
}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCSJrLcMUVltUHcVjtC8ZotBshfiue8J68&callback=initMap"></script>
map=null;
poly=null;
函数initMap(){
var directionsDisplay=新建google.maps.DirectionsRenderer;
var directionsService=新的google.maps.directionsService;
map=new google.maps.map(document.getElementById('map'){
缩放:7,
中心:{lat:-18.92379,lng:47.542537},
mapTypeId:google.maps.mapTypeId.ROADMAP
}
);
方向显示.setMap(地图);
poly=新的google.maps.Polyline({
strokeColor:“#000000”,
笔划不透明度:1.0,
冲程重量:3
});
poly.setMap(map);
document.getElementById('Organization')。addEventListener('change',function(){
GetFlotteByOrganization(document.getElementById(“Organization”).value);
});
}
如何删除这两个按钮?一个选项是禁用默认用户界面:
disableDefaultUI: true
在街景控件和缩放控件中添加回(如果需要):
代码片段:
html,
身体,
#地图{
身高:100%;
宽度:100%;
填充:0px;
边际:0px;
}
map=null;
poly=null;
函数initMap(){
var directionsDisplay=新建google.maps.DirectionsRenderer;
var directionsService=新的google.maps.directionsService;
map=new google.maps.map(document.getElementById('map'){
缩放:7,
中心:{
lat:-18.92379,
液化天然气:47.542537
},
disableDefaultUI:true,//禁用默认控件
streetView控件:true,//添加回streetView控件
zoomControl:true,//添加回缩放控件
mapTypeId:google.maps.mapTypeId.ROADMAP
});
方向显示.setMap(地图);
poly=新的google.maps.Polyline({
strokeColor:“#000000”,
笔划不透明度:1.0,
冲程重量:3
});
poly.setMap(map);
}
一个选项是禁用默认用户界面:
disableDefaultUI: true
在街景控件和缩放控件中添加回(如果需要):
代码片段:
html,
身体,
#地图{
身高:100%;
宽度:100%;
填充:0px;
边际:0px;
}
map=null;
poly=null;
函数initMap(){
var directionsDisplay=新建google.maps.DirectionsRenderer;
var directionsService=新的google.maps.directionsService;
map=new google.maps.map(document.getElementById('map'){
缩放:7,
中心:{
lat:-18.92379,
液化天然气:47.542537
},
disableDefaultUI:true,//禁用默认控件
streetView控件:true,//添加回streetView控件
zoomControl:true,//添加回缩放控件
mapTypeId:google.maps.mapTypeId.ROADMAP
});
方向显示.setMap(地图);
poly=新的google.maps.Polyline({
strokeColor:“#000000”,
笔划不透明度:1.0,
冲程重量:3
});
poly.setMap(map);
}