How do I know when the google map is in streetview mode or roadmap mode? Is there an event that gets fired? I tried looking through the docs, and there doesn't seem to be anything. Am I missing something?
When the user switches into streetview mode, I want the UI to change, but I don't know which event to bind to.
Instead of clicking the "Street View" button, this is now accessed using the "pegman" button in the left hand corner. When the "pegman" icon is dragged over the map blue polylines appear where Street View is available and a small window will show the current Street View.
In general, Google tries to take new Street View photos in major cities once every year. Less populated areas can probably expect new photos every three years or so — but don't be surprised if it takes even longer.
Navigate with Live View. Google Maps offers two views for walking navigation: the 2D map and Live View. With Live View, you get directions placed in the real world and on a mini map at the bottom of your screen. You can use Live View navigation during the walking portion of any type of trip.
Detect the visible_changed
event on the StreetViewPanorama
associated with your Map
object. You can get the panorama from the map by calling its getStreetView()
method and bind the handler to that object's event. You will have to test the StreetViewPanorama
's visibility by calling its getVisible()
method.
For instance:
var map = new google.maps.Map(document.getElementById("theMap"), {streetViewControl: true}); var thePanorama = map.getStreetView(); google.maps.event.addListener(thePanorama, 'visible_changed', function() { if (thePanorama.getVisible()) { // Display your street view visible UI } else { // Display your original UI } });
See the events section of the StreetViewPanorama Object Documentation for more events you can listen for on this object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With