【问题标题】:Get rid of sidebar when linking to Google Maps Streetview链接到谷歌地图街景时去掉侧边栏
【发布时间】:2010-09-01 09:19:38
【问题描述】:

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

【问题讨论】:

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


    【解决方案1】:

    考虑以下示例。它使用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>
    

    截图:

    【讨论】:

    • 我是在创建链接之后,而不是自己创建全景图。我们可能会这样做,并在我们的网站上创建一个弹出对话框,但最初我们计划只在街景视图上提供一个指向该位置的链接。
    • @Ian:这是已知的 Google 地图参数列表:mapki.com/wiki/Google_Map_Parameters。但是似乎没有删除侧栏的选项。也许output=embed 很接近,但这不适用于链接。
    • 是的,我在我的问题中包含了指向 mapki 的链接。我看过那里但没有找到任何东西。因此在这里问。
    猜你喜欢
    • 2013-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-09
    • 1970-01-01
    相关资源
    最近更新 更多