developer tip

Google지도의 위성보기를 비활성화하는 방법은 무엇입니까?

optionbox 2020. 9. 23. 07:32
반응형

Google지도의 위성보기를 비활성화하는 방법은 무엇입니까?


Google Maps Javascript API V 3에서 작업 중입니다.

모든 것이 잘 작동하지만 SATELLITE 버튼으로 오른쪽 상단 영역에 나타나는 MAP 버튼을 비활성화하고 싶습니다.

어떻게 할 수 있습니까?


지도를 활성화하고 옵션을 전달할 때 mapTypeControlOptions를 지정할 수 있습니다. 여기에는 사용자가 볼 수있는지도 유형의 종류를 지정하는 배열이 있습니다. http://code.google.com/apis/maps/documentation/javascript/reference.html#MapTypeControlOptions에서 볼 수 있습니다 .

사용자가지도 유형에 대한 옵션을 갖지 않도록하려면 maps mapTypeControl을 false로 설정하여이를 지정할 수도 있습니다.


var myOptions = {
    zoom: 2,
    center: **Your LatLng object**,
    mapTypeControlOptions: {
      mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID]
    }, // here´s the array of controls
    disableDefaultUI: true, // a way to quickly hide all controls
    mapTypeControl: true,
    scaleControl: true,
    zoomControl: true,
    zoomControlOptions: {
      style: google.maps.ZoomControlStyle.LARGE 
    },
    mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); // displays in <article id="map_canvas"></article>
//map.mapTypeControl = false; // OPTIONAL: hides the map control

위성 비활성화 옵션 :

mapTypeControl: false

스트리트 뷰를 사용 중지합니다.

streetViewControl: false

CSS를 통해 숨길 수 있습니다.

.gm-style-mtc {
  display: none;
}

mapTypeControl 및 streetViewControl 옵션을 false로 설정

 var map = new google.maps.Map(document.getElementById('map_canvas'), {
             center: new google.maps.LatLng(latitudeFirst, longitudeFirst),
             zoom: 12,
             streetViewControl: false,
             mapTypeControl: false
        });  

나는 같은 문제가 있었다. mapTypeControl: false다른 옵션을 설정 하고 전달하는 것이 저에게 효과적이었습니다. 여기에서 사양을 확인할 수 있습니다 .

참고 URL : https://stackoverflow.com/questions/5976854/how-to-disable-google-maps-satellite-view

반응형