javascript - Google map Javascript API v3 - Ricoh Theta 和自定义街景全景

标签 javascript google-maps google-maps-api-3 photosphere

我需要你的帮助,但我会很简短。

我有一台理光 Theta 相机(360 度相机)。现在我想向我的网站添加自定义街景全景图。但是,该 API 错误地转换了从 Ricoh Theta 上传的所有图像。 图像的比例为3584 x 1792

我发现不同的浏览器以不同的方式显示我的图像。 Firefox 和 IE 做得相对不错,但仍然不是 Google 全景图的样子。

更新:
这就是我到目前为止所做的。我严格遵循文档中 Google 的示例。

<!DOCTYPE html>
<html>
  <head>
    <title>16 Dempsey Crescent</title>
    <meta charset="utf-8">
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true">
    </script>
<script>
var panorama;

// The panorama that will be used as the entry point to the custom
// panorama set.
var entryPanoId = null;

function initialize() {
  // The latlng of the entry point to the Google office on the road.
  var dempseyCres = new google.maps.LatLng(43.753859,-79.374082);

  // Set up the map and enable the Street View control.
  var mapOptions = {
    center: dempseyCres,
    zoom: 16
  };
  var map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);

  panorama = map.getStreetView();
  // Set up Street View and initially set it visible. Register the
  // custom panorama provider function.
  var panoOptions = {
    position: dempseyCres,
    visible: true,
    panoProvider: getCustomPanorama
  };
  panorama.setOptions(panoOptions);

  // Create a StreetViewService object.
  var streetviewService = new google.maps.StreetViewService();

  // Compute the nearest panorama to the Google Sydney office
  // using the service and store that pano ID.
  var radius = 50;
  streetviewService.getPanoramaByLocation(dempseyCres, radius,
      function(result, status) {
    if (status == google.maps.StreetViewStatus.OK) {
      // We'll monitor the links_changed event to check if the current
      // pano is either a custom pano or our entry pano.
      google.maps.event.addListener(panorama, 'links_changed',
        function() {
          createCustomLinks(result.location.pano);
        });
    }
  });
}

function getCustomPanoramaTileUrl(pano, zoom, tileX, tileY) {
  // Return a pano image given the panoID.
  /*return 'images/panoReception1024-' + zoom + '-' + tileX + '-' + tileY +
      '.jpg';*/
      return 'images/R0010029.JPG';

}

function getCustomPanorama(pano) {
  switch (pano) {
    case 'room-1':
      return {
        location: {
          pano: 'room-1',
          description: '16 Dempsey Crescent',
          latLng: new google.maps.LatLng(43.753859,-79.374082)
        },
        links: [],
        // The text for the copyright control.
        copyright: 'Imagery (c) 2010 Google',
        // The definition of the tiles for this panorama.
        tiles: {
          tileSize: new google.maps.Size(1700, 850),
          worldSize: new google.maps.Size(3584, 1792),
          // The heading at the origin of the panorama tile set.
          centerHeading: 105,
          getTileUrl: getCustomPanoramaTileUrl
        }
      };
      break;
    default:
      return null;
  }
}

function createCustomLinks(entryPanoId) {
  var links = panorama.getLinks();
  var panoId = panorama.getPano();

  switch (panoId) {
    case entryPanoId:
      // Adding a link in the view from the entrance of the building to
      // reception.
      links.push({
        heading: 340,
        description: 'Enter The House',
        pano: 'room-1'
      });
      break;
    case 'room-1':
      // Adding a link in the view from the entrance of the office
      // with an arrow pointing at 100 degrees, with a text of 'Exit'
      // and loading the street entrance of the building pano on click.
      links.push({
        heading: 110,
        description: 'Back to the Street',
        pano: entryPanoId
      });
      break;
    default:
      return;
  }
}

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

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

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

如果您能帮助我解决这个问题,我将非常感激。

最佳答案

您可以尝试设置您的图 block 选项对象,以便世界和图 block 大小相等吗?看来你没有瓷砖那么多,只有一张大全景图。

tiles: {
      tileSize: new google.maps.Size(3584, 1792),
      worldSize: new google.maps.Size(3584, 1792),
      // The heading at the origin of the panorama tile set.
      centerHeading: 105,
      getTileUrl: getCustomPanoramaTileUrl
    }

关于javascript - Google map Javascript API v3 - Ricoh Theta 和自定义街景全景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30623711/

相关文章:

javascript - 谷歌地图地理位置刷新页面

javascript - 谷歌地图折线虚线和双线

google-maps - 谷歌地图 API v3 : Markers not being removed

javascript - 这种比较行为是否定义明确?

javascript - 使用 Array.reduce 的奇怪结果

javascript - 创建新元素时创建 jQuery

javascript - onScroll 事件被多次调用

javascript - 更改谷歌地图API 3中不同map.data.loadGeoJson数据集的标记

android - 谷歌地图不适用于谷歌游戏

javascript - 调整谷歌地图大小不起作用并且需要很长时间