【问题标题】:get single panoramic photo from Street View pano从街景全景中获取单张全景照片
【发布时间】:2015-08-04 15:41:40
【问题描述】:

我上传了一张街景图,其中的代码取自 Google API。如果我点击远离我的位置或使用箭头改变全景,我会避免这种情况,那么可以删除与其他全景的连接或获取单个全景照片以像谷歌视图一样运行自己?

代码很简单:

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Street View containers</title>
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0;
        padding: 0;
      }

    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
    <script>
    function initialize() {
     var bryantPark = new google.maps.LatLng(37.869260, -122.254811);
      var panoramaOptions = {
       position: bryantPark,
       pov: {
        heading: 165,
       pitch: 0
    },
    zoom: 1
  };
  var myPano = new google.maps.StreetViewPanorama(
      document.getElementById('map-canvas'),
      panoramaOptions);
  myPano.setVisible(true);
}

google.maps.event.addDomListener(window, 'load', initialize);

    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>
</html>

我希望这张全景照片的功能与https://www.google.com/maps/views/home?gl=us&hl=it 的功能一样:https://www.google.com/maps/views/view/105558295291738522367/gphoto/5999530155782979586?gl=us&hl=it&heading=33&pitch=90&fovy=75 这与连接到其他全景图像的街景不同,这与其他全景图无关。

【问题讨论】:

  • 你能说明你想要做什么吗?或许提供您的代码来演示该问题?
  • 更多信息在描述中,请注意

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


【解决方案1】:

如果您不想要链接,请将 linksControl StreetViewPanoramOption 设置为 false。

linksControl: false

代码 sn-p:

function initialize() {
  var bryantPark = new google.maps.LatLng(37.869260, -122.254811);
  var panoramaOptions = {
    position: bryantPark,
    linksControl: false,
    clickToGo: true,
    pov: {
      heading: 165,
      pitch: 0
    },
    zoom: 1
  };
  var myPano = new google.maps.StreetViewPanorama(
    document.getElementById('map-canvas'),
    panoramaOptions);
  myPano.setVisible(true);
}

google.maps.event.addDomListener(window, 'load', initialize);
html,
body,
#map-canvas {
  height: 100%;
  margin: 0;
  padding: 0;
}
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<div id="map-canvas"></div>

【讨论】:

  • 我需要 ClickToGo,在 Google 视图中,它用于将我用鼠标单击的相机居中
  • 默认设置为true
猜你喜欢
  • 1970-01-01
  • 2017-06-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多