Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable indoor view of buildings in Google Maps Street View

I'm working on a project which displays a bunch of markers on Google Maps and allows the user to search and get relevant information about the locations. I haven't disabled Street View, as I'd like to give the user the possibility to see the building from the outside.

For certain locations, however, when going into Street View mode, Google Maps immediately shows the indoor of an adjacent business. What I'd like to have is the ability to completely disable indoor view on my application.

Is anyone aware of a certain setting in the Google Maps API that would do that or perhaps a clever hack to solve the issue? I haven't honestly found anything.

like image 848
Ciambello Avatar asked Aug 27 '15 18:08

Ciambello


People also ask

How do you hide buildings on Google Maps?

1 Answer. Show activity on this post. To hide buildings, you need set "visibility": "simplified" globally before adding any specific styles. You can then go back and set the visibility to "on" and add additional styles back in for each element.

How do I block my house from Google Street View?

Just look up your address, enter Street View, click report a problem, and choose blur “My home.”

Can Google Maps see inside buildings?

You can see what some places look like on the inside before you visit. On Google Maps, you can see: The interior of places like stores, airports, or hotels.

Can you pay Google to blur out your house?

If Google is the owner of the photo, you can request blurring or report the photo, as long as it contains: Your face, home, or other identifying information. Anything that violates the Google-contributed Street View privacy policies.


1 Answers

In the experimental version (currently v=3.21) there is now a StreetViewSource that can be provided in a StreetViewLocationRequest

StreetViewSource class

google.maps.StreetViewSource class

Identifiers to limit Street View searches to selected sources.

Constant
DEFAULT Uses the default sources of Street View, searches will not be limited to specific sources.
OUTDOOR Limits Street View searches to outdoor collections only.
  • example of request without source: google.maps.StreetViewSource.OUTDOOR (fiddle)
  • example of request with source: google.maps.StreetViewSource.OUTDOOR (fiddle)

code snippet (with source: OUTDOOR):

/*
 * Click the map to set a new location for the Street View camera.
 */

var map;
var panorama;

function initMap() {
  var myLatlng = new google.maps.LatLng(51.343364, 12.378962999999999);
  var sv = new google.maps.StreetViewService();

  panorama = new google.maps.StreetViewPanorama(document.getElementById('pano'));

  // Set up the map.
  map = new google.maps.Map(document.getElementById('map'), {
    center: myLatlng,
    zoom: 16,
    streetViewControl: false
  });

  // Set the initial Street View camera to the center of the map
  sv.getPanorama({
    location: myLatlng,
    radius: 50,
    source: google.maps.StreetViewSource.OUTDOOR
  }, processSVData);

  // Look for a nearby Street View panorama when the map is clicked.
  // getPanoramaByLocation will return the nearest pano when the
  // given radius is 50 meters or less.
  map.addListener('click', function(event) {
    sv.getPanorama({
      location: event.latLng,
      radius: 50
    }, processSVData);
  });
}

function processSVData(data, status) {
  if (status === google.maps.StreetViewStatus.OK) {
    var marker = new google.maps.Marker({
      position: data.location.latLng,
      map: map,
      title: data.location.description
    });

    panorama.setPano(data.location.pano);
    panorama.setPov({
      heading: 270,
      pitch: 0
    });
    panorama.setVisible(true);

    marker.addListener('click', function() {
      var markerPanoID = data.location.pano;
      // Set the Pano to use the passed panoID.
      panorama.setPano(markerPanoID);
      panorama.setPov({
        heading: 270,
        pitch: 0
      });
      panorama.setVisible(true);
    });
  } else {
    console.error('Street View data not found for this location.');
  }
}
google.maps.event.addDomListener(window, 'load', initMap);
      html,
      body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
      #map {
        height: 100%;
      }
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk"></script>
<div id="map" style="width: 45%; height: 100%;float:left"></div>
<div id="pano" style="width: 45%; height: 100%;float:left"></div>
like image 76
geocodezip Avatar answered Sep 22 '22 10:09

geocodezip