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


i've got streetviewpanorama identified lat lng coordinates. lat , lng coordinates not on road google car took picture, in center of building want see in streetview's picture. have 2 couple of coordinates, , think it's possible calculate pov degrees obtain correct shot of building. need how lon lat of point in automatically placed "the man", can calculate correct pov degrees.

my implementation of kiks73's solution.

make sure add geometry library when loading maps api:

https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=visualization,places,geometry&sensor=true 

var dist = 50;  service.getpanoramabylocation(targetlatlng, dist, function(panodata){     panoramalatlng = panodata.location.latlng;     initstreetview(targetlatlng, panoramalatlng)     });  function initstreetview(targetlatlng, panoramalatlng){      var panoramaoptions = {         position: targetlatlng     };      var streetview = new google.maps.streetviewpanorama(document.getelementbyid('streetview'),panoramaoptions);     var heading = google.maps.geometry.spherical.computeheading(panoramalatlng, targetlatlng);     map.setstreetview(streetview);           streetview.setpov({heading:heading, pitch:0});                    }                

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -