How to remove a MapType from google map using Google Maps Javascript V3 API?

前端 未结 4 807

Here is the snippet I am using to display Google map on my app using their V3 Javascript API.

var myOptions = {
            zoom: 15,
            mapTypeId:          


        
相关标签:
4条回答
  • 2020-12-24 15:04

    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

    0 讨论(0)
  • 2020-12-24 15:10

    To disable only map control, use this option in Gmap3 documentation :

    mapTypeControl
    Type: boolean

    The initial enabled/disabled state of the Map type control.

    example:

    var options = {
       // ...
       mapTypeControl: false
    }
    var map = new google.maps.Map(document.getElementById("map"), options);
    
    0 讨论(0)
  • 2020-12-24 15:19

    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.

    0 讨论(0)
  • 2020-12-24 15:28

    So there's no URL attribute for disabling the satellite/terrain maps from Google's own embed code?

    0 讨论(0)
提交回复
热议问题