0

Hi i am new to google street view api and javascript. i am trying to write a code through which i can rotate the image in street view at a particular longitude and latitude. the angle doesn't matter....here is the code

<!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);

//this loop is for waiting the image to load..i know this is not efficient but just wanted to give ample time for image to load for(var k=0;k<10000;k++){}

}

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

</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>

when i execute the whole code..only a image at particular angle comes..it doesn't rotate.

Can you please help me? :)

user609306
  • 1,333
  • 6
  • 17
  • 27

1 Answers1

0

Take a look at my question and myself answer at this link. It doesn't rotate interactively, but the street view view is set for watching the point at lat,long. I hope it is what you need.

Google Maps Api StreetView PanoramaOptions Point of View Setting from Lon Lat

Community
  • 1
  • 1
kiks73
  • 3,718
  • 3
  • 25
  • 52