2013-06-26 72 views

回答

14

這應該刪除街景(男子)和平移控制:

var mapOptions = { 
    center: mapCenter, 
    zoom: 10, 
    panControl: false, 
    streetViewControl: false, 
    mapTypeId: google.maps.MapTypeId.ROADMAP  
}; 

使用谷歌地圖的選項的例子:

var map; 
function initialize() { 
    var mapOptions = { 
    zoom: 8, 
    center: new google.maps.LatLng(-34.397, 150.644), 
    mapTypeId: google.maps.MapTypeId.ROADMAP 
    }; 
    map = new google.maps.Map(document.getElementById('map-canvas'), 
     mapOptions); 
} 
google.maps.event.addDomListener(window, 'load', initialize); 
+0

我不使用地圖選項。我應該在哪裏添加這個?調用一個事件監聽器?這是我的源代碼:view-source:http://f.hybridsoftware.net/map.htm – user1688401

+0

我可以從你的代碼中看到,你正在做的事情有點不同,你直接在canvas節點上執行映射操作。通常會創建一個'map'變量,然後綁定到canvas div,如我添加到我的響應中的示例所示。將選項直接應用到canvas div可能是可能的,但我並不熟悉它。 – jdehlin

2

我希望你工作

function initialize() { 
    var mapOptions = { 
    zoom: 8, 
    center: new google.maps.LatLng(-34.397, 150.644), 
    disableDefaultUI: true, //disables controls 
    zoomControl: true,  //zoom control enables 
    zoomControlOptions: { 
    style: google.maps.ZoomControlStyle.LARGE, //enables the dimension 
    position: google.maps.ControlPosition.TOP_RIGHT //position enables 
    }, 

    mapTypeId: google.maps.MapTypeId.ROADMAP 
    }; 
    map = new google.maps.Map(document.getElementById('map-canvas'), 
    mapOptions); 
    } 
+0

我不使用地圖選項。我應該在哪裏添加這個?調用一個事件監聽器?這是我的來源:view-source:f.hybridsoftware.net/map.htm – user1688401

1

以上答案不符合您的問題。試試這個讓我的工作禁用了人物圖標。

mapTypeControl:false, 
scaleControl:false, 
streetViewControl:false, 
overviewMapControl:false, 
rotateControl:false, 

,如果你想刪除所有然後使用此:如果你想樣式的地圖顏色

mapTypeControl: false, 
disableDefaultUI: true, 

,試試這個:

var mapStyles = [ {"featureType":"road","elementType":"labels","stylers":[{"visibility":"simplified"},{"lightness":20}]},{"featureType":"administrative.land_parcel","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"landscape.man_made","elementType":"all","stylers":[{"visibility":"on"}]},{"featureType":"transit","elementType":"all","stylers":[{"saturation":-100},{"visibility":"on"},{"lightness":10}]},{"featureType":"road.local","elementType":"all","stylers":[{"visibility":"on"}]},{"featureType":"road.local","elementType":"all","stylers":[{"visibility":"on"}]},{"featureType":"road.highway","elementType":"labels","stylers":[{"visibility":"simplified"}]},{"featureType":"poi","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"road.arterial","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":50}]},{"featureType":"water","elementType":"all","stylers":[{"hue":"#3b5998"},{"saturation":30},{"lightness":49}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"hue":"#3b5998"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"hue":"#3b5998"}]}, {featureType:'road.highway',elementType:'all',stylers:[{hue:'#3b5998'},{saturation:-92},{lightness:60},{visibility:'on'}]}, {featureType:'landscape.natural',elementType:'all',stylers:[{hue:'#3b5998'},{saturation:-71},{lightness:-18},{visibility:'on'}]}, {featureType:'poi',elementType:'all',stylers:[{hue:'#3b5998'},{saturation:-70},{lightness:20},{visibility:'on'}]} ]; 

改變顏色屬性號碼,只要你喜歡,然後把這種風格在你的地圖:

mapTypeId: google.maps.MapTypeId.ROADMAP, 
zoom: 9, // optional based on your requirement 
styles: mapStyles 

如果你想樣式的圖標,然後把這個:

marker = new google.maps.Marker({ 
icon: "/images/icon/marker123.png", // based on your dir file 
position: point, // based on your srcipt selection 
map: map 

希望這個有用的人。 :)

2

禁用該男子圖標,可以設置將streetViewControl進入一種虛假的在地圖中選擇。

streetViewControl: false