2013-07-03 17 views
0

嗨,我是新的谷歌街景视图API和JavaScript。我想写一个代码,通过它我可以在特定的经度和纬度上在街景中旋转图像。角度不要紧....这里是代码谷歌街景从一个单一的点通过一定的程度,并看到它的视觉影响

<!DOCTYPE html> 
<html> 
<head> 
<meta charset="utf-8"> 
<title>Street View service</title> 
<link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet"> 
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> 
<script> 
//this for loop is for rotating the image. 
for(var i=0;i<15;i++) { 

function initialize() { 



var fenway = new google.maps.LatLng(42.345573,-71.098326); 
    var mapOptions = { 
    center: fenway, 
    zoom: 14, 
    mapTypeId: google.maps.MapTypeId.ROADMAP 
    }; 
    var map = new google.maps.Map(
    document.getElementById('map-canvas'), mapOptions); 
    var panoramaOptions = { 
    position: fenway, 
    pov: { 
    heading: 0+10*i, 
    pitch: 10 
    } 
}; 
    var panorama = new  google.maps.StreetViewPanorama(document.getElementById('pano'),panoramaOptions); 
map.setStreetView(panorama); 

//这个循环是等待图像load..i知道这是不是有效,但只是想给充足的时间用于图像用于负载 (VAR K = 0; k < 10000; k ++){}

}

google.maps.event.addDomListener(窗口, '负载',初始化); }

</script> 

<div id="pano" style="position:absolute; left:10px; top: 8px; width: 1300px; height: 670px;"></div> 
<div id="map-canvas" style="left:1100px; top: 450px;width: 200px; height: 200px"></div> 

当我执行整个

code..only在特定角度comes..it一图像不旋转。

你能帮我吗? :)

回答