I'm using the Google Maps JavaScript API v3. Is it possible to disable/hide all street view UI in google maps?
I tried
disableDefaultUI: true
in the map options but doesn't disable the UI in street view.
I'm using the following code to display street view on a click marker event:
service.getPanoramaByLocation(marker.getPosition(), 200, function(result, status) {
if (status == google.maps.StreetViewStatus.OK) {
var panorama = map.getStreetView();
panorama.setPosition(result.location.latLng);
panorama.setVisible(true);
disableDefaultUI: true;
} else {
alert("No street view is available within " + 200 + " meters");
return;
}
});
I'm using the Google Maps JavaScript API v3. Is it possible to disable/hide all street view UI in google maps?
I tried
disableDefaultUI: true
in the map options but doesn't disable the UI in street view.
I'm using the following code to display street view on a click marker event:
service.getPanoramaByLocation(marker.getPosition(), 200, function(result, status) {
if (status == google.maps.StreetViewStatus.OK) {
var panorama = map.getStreetView();
panorama.setPosition(result.location.latLng);
panorama.setVisible(true);
disableDefaultUI: true;
} else {
alert("No street view is available within " + 200 + " meters");
return;
}
});
Share
Improve this question
asked Feb 2, 2014 at 3:09
CyberJunkieCyberJunkie
22.7k61 gold badges154 silver badges219 bronze badges
1
-
1
disableDefaultUI: true;
will produce a syntax error. What exactly do you want to disable? – Salman Arshad Commented Feb 2, 2014 at 9:22
3 Answers
Reset to default 3You have to use map option streetViewControl
and set it to false
like:
var mapOptions = {
zoom: 15,
center: new google.maps.LatLng(52.5, 13.4),
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false
};
You might want to check this: https://developers.google./maps/documentation/javascript/reference#StreetViewPanoramaOptions
var panoramaOptions = {
disableDefaultUI: true
};
panorama = new google.maps.StreetViewPanorama(document.getElementById("pano"), panoramaOptions);
Here is a demo.
If you are in angular 8 you can do it in the following way:
"@angular/google-maps": "^10.1.3", --> package.json
<google-map width="100%" height="100%" [center]="center" [zoom]="zoom"
[options]="mapOptions">
The options to use are:
mapOptions = {
fullscreenControl: false,
disableDefaultUI: true
};