链接到 Google 地图街景时去掉侧边栏

发布于 2024-09-17 17:08:31 字数 413 浏览 3 评论 0原文

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

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瞎闹 2024-09-24 17:08:31

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文