Javascript 谷歌地图街景-检索geolat/Geoling

Javascript 谷歌地图街景-检索geolat/Geoling,javascript,google-maps-api-3,google-street-view,Javascript,Google Maps Api 3,Google Street View,在Google Maps Streetview(V3)中,可以通过监视事件来读取俯仰、方向和缩放 google.maps.event.addListener(panorama, "pov_changed", function() { var panoInfo = panorama.getPov(); // Picth etc document.getElementById("orgpit").value=panoInfo['pitch'];

在Google Maps Streetview(V3)中,可以通过监视事件来读取俯仰、方向和缩放

google.maps.event.addListener(panorama, "pov_changed", function() { 
     var panoInfo       = panorama.getPov();

      // Picth etc
      document.getElementById("orgpit").value=panoInfo['pitch'];
      document.getElementById("orghea").value=panoInfo['heading'];
      document.getElementById("orgzoo").value=panoInfo['zoom'];
});

但是,当街景中的位置发生变化时,我如何检索新的geolat/Geoling呢?

您可以使用以下方法:

var pano = new google.maps.StreetViewPanorama(document.getElementById('yourPanoDiv'), yourPanoOptions);

google.maps.event.addListener(pano, 'position_changed', function() {
  var yourNewPosition = pano.getPosition(); // a google.maps.LatLng object
  // do something with yourNewPosition like
  // alert(yourNewPosition.lat()+" "+yourNewPosition.lon());
});
还可以尝试“pano_changed”事件而不是“position_changed”,以找出哪一个更适合您的需要。

panorama.getPosition()