javascript - Grey background for my streetview app -


i'm trying make geolocation app work , after lot of verification , console.log() functions, should work. problem doesn't work. have grey background instead of streetview want.

here code :

streetview: function (latitude, longitude) {     $('#streetview').css({'width': $(window).width(), 'height': $(window).height()});      var lookto = {lat:  parsefloat(latitude), lng:  parsefloat(longitude)};     var latlong = new google.maps.latlng(parsefloat(latitude), parsefloat(longitude));     var panooptions = {         position: lookto,         pancontrol: false,         addresscontrol: false,         linkscontrol: false,         zoomcontroloptions: false     };     // initialize new panorama api object , point element id streetview container     var pano = new google.maps.streetviewpanorama(document.getelementbyid('streetview'), panooptions);     // initialize new streetviewservice object     var service = new google.maps.streetviewservice;     // call "getpanoramabylocation" function of streetview services return closest streetview position entered coordinates     console.log('pano positon :'+ pano.getposition());     service.getpanoramabylocation(pano.getposition(), 50, function (panodata) {         // if function returned result         if (panodata != null) {             // gps coordinates of streetview camera position             var panocenter = panodata.location.latlng;             console.log('panocenter' + panocenter);             // "computeheading" function calculates heading 2 gps coordinates entered parameters             var heading = google.maps.geometry.spherical.computeheading(panocenter, latlong);             console.log('heading : '+ heading);             // know heading (camera direction, elevation, zoom, etc) set parameters panorama object             var pov = pano.getpov();             pov.heading = heading;             pano.setpov(pov);             // set marker on location looking at, verify calculations correct             var marker = new google.maps.marker({                 map: pano,                 position: lookto             });         } else {             // no streetview found             console.log('not found');         }     });  } 

i copied part of code find google api , there comments. should readable. if has idea ...

try set zoom parameter. if not work, please note versions 3.20, 3.21, 3.22 not available anymore stated in forum. check documentation. if browser internet explorer, please ensure use supported version , not use compatibility mode.

check these related questions:

use google.maps.streetviewservice.getpanoramabylocation() determine if there panorama available given location.

hope helps!


Comments

Popular posts from this blog

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -