Reputation: 1
In Google Maps Streetview (V3) the Pitch, Heading and Zoom can be read by monitoring the event
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'];
});
But when the position changes in Streetview, how can I retrieve the new geolat/geolng as well?
Upvotes: 0
Views: 143
Reputation: 2251
You can use something like:
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());
});
Try also the event 'pano_changed' instead of 'position_changed', to find out which one better fits your needs.
Upvotes: 1