链接到Google地图街景时,摆脱侧边栏

时间:2010-09-01 09:19:39

标签: google-maps google-maps-api-3 google-street-view

我正在使用v3地图JS API google.maps.getPanoramaByLocation来创建一个带有lat / lng的街景视图的链接,如下所示:http://maps.google.com/?cbll=52.099659,0.140299&cbp=12,0,,,&layer=c,但我想知道是否有人知道如何摆脱默认情况下出现在街景视图中的大型左侧边栏?我检查了mapki,但没有骰子。

1 个答案:

答案 0 :(得分:0)

考虑以下示例。它使用getPanoramaByLocation()方法,并且不呈现左侧边栏:

<!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>

截图:

Google Maps API v3 - Street View Demo