views:

27

answers:

1

I'm using the v3 maps JS API google.maps.getPanoramaByLocation to create a link to streetview with lat/lng which looks like: http://maps.google.com/?cbll=52.099659,0.140299&cbp=12,0,,,&layer=c, but I was wondering if anyone knew how to get rid of the large left-hand sidebar that appears in street view by default? I've checked mapki but no dice.

A: 

Consider the following example. It uses the getPanoramaByLocation() method, and does not render a left sidebar:

<!DOCTYPE html>
<html> 
<head> 
  <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
  <title>Google Maps API v3 - Street View Demo</title> 
  <script src="http://maps.google.com/maps/api/js?sensor=false"
          type="text/javascript"></script> 
  </head> 
  <body> 
    <div id="pano" style="width: 400px; height: 300px;"></div>
    <script type="text/javascript"> 
      var panorama = new google.maps.StreetViewPanorama(
        document.getElementById('pano')
      );
      var sv = new google.maps.StreetViewService();
      sv.getPanoramaByLocation(
        new google.maps.LatLng(42.345573,-71.098326), 
        50, 
        function (data, status) {
          if (status == google.maps.StreetViewStatus.OK) {
            panorama.setPano(data.location.pano);
            panorama.setPov({ heading: 270, pitch: 0, zoom: 1 });
            panorama.setVisible(true);
          }
        }
      );
    </script> 
  </body> 
</html>

Screenshot:

Google Maps API v3 - Street View Demo

Daniel Vassallo
I was after creating a link, not creating a panorama myself.We may go with this and create a popup dialog on our site, but originally we'd planned to just have a link to the position on Street View.
Ian Grainger
@Ian: This is a list of known Google Maps parameters: http://mapki.com/wiki/Google_Map_Parameters. However there doesn't seem to be the option to remove the side bar. Maybe the `output=embed` is close, but that is not supposed to work for links.
Daniel Vassallo
@Daniel - yeah, I included the link to mapki in my question. I'd looked there but not found anything. Hence asking here.
Ian Grainger