Here is the snippet I am using to display Google map on my app using their V3 Javascript API.
var myOptions = {
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
But the map shows terrain, hybrid and satellite which I don't want. How do I remove those controls from the map.
You can remove all the default UI
var mapOptions = {
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true
};
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
And then you can add your own controls
Or you can just add mapTypeControl: false
The Google Maps v3 API doc is great.
In it, you'll find that MapOptions have a property, "mapTypeControl", which is a boolean. Set it to false
to disable it for your map.
那么从谷歌自己的嵌入代码中禁用卫星/地形地图没有URL属性?
To disable only map control, use this option in Gmap3 documentation :
mapTypeControl
Type: booleanThe initial enabled/disabled state of the Map type control.
example:
var options = {
// ...
mapTypeControl: false
}
var map = new google.maps.Map(document.getElementById("map"), options);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.