2015-06-03 2 views
1

Мне нужна ваша помощь, и я буду кратким.Google Maps Javascript API v3 - Ricoh Theta & Custom Street View Panorama

У меня есть камера Ricoh Theta (камера на 360 градусов). Теперь я хочу добавить пользовательскую уличную панораму на мой сайт. Однако API неправильно преобразует все изображения, загруженные из Ricoh Theta. Соотношение изображений 3584 x 1792

Я выяснил, что разные браузеры отображают мои изображения по-разному. Firefox и IE делают относительно хорошую работу, но это все еще не то, что выглядят панорамы Google.

UPDATE:
Это то, что я сделал до сих пор. Я строго следовал примерам 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> 

Я бы очень признателен, если бы вы помогли мне решить эту проблему.

+1

Можете ли вы добавить пример кода того, что вы сделали до сих пор, чтобы мы могли его отладить? – Kmeixner

+1

@Kmeixner Спасибо за ответ! Я обновил свое сообщение. Я также с удовольствием добавлю фотографии, но, к сожалению, мой представитель слишком низок. –

+0

Возможно, ваша переменная панорамы неверна. попробуйте эту «var panorama = new google.maps.StreetViewPanorama» ( document.getElementById ('map-canvas'), panoOptions); ' – Verma

ответ

0

Не могли бы вы попытаться установить свой объект опций плитки так, чтобы размер мира и плитки был равен? Кажется, у вас нет плиток так, как одна большая панорама.

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 
    }