I have a simple street view working to show me a street view given an address:
var geocoder = new google.maps.Geocoder();
var address = "344 Laguna Dr, Milpitas, CA 95035";
geocoder.geocode( { 'address': address},
function(results, status) {
//alert (results);
if (status == google.maps.GeocoderStatus.OK) {
//alert(results[0].geometry.location);
myStreetView = new google.maps.StreetViewPanorama(document.getElementById("map_canvas"));
myStreetView.setPosition(results[0].geometry.location);
var marker = new google.maps.Marker({
position: results[0].geometry.location,
map: myStreetView,
title:address
});
//alert ("yay");
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
As you can see, I add a marker for the address onto the street view. My question is, the street view is pointing north, and the marker is to the south. For a non-specific address, how do I designate that the street view should point at the marker for the address instead of pointing north by default?
results[0].geometry.location
), socomputeAngle
always returns0
. Yet on the actual panorama, the marker is displayed not exactly where the camera is (which is in the middle of the road), but on a side of the road, against an actual building. – Deuteronomy