Skip to content Skip to sidebar Skip to footer

Google Maps Streetview Infowindows Opening On Map

When I add a marker and InfoWindow to my Google Maps application the marker is correctly added to both the map and the default StreetView panorama. I also add InfoWindows to both c

Solution 1:

Google broke this functionality in v3.25.

v3.24 was the last version which worked correctly.

v3.24 has been retired and is no longer available - there does not seem to be any simple workaround in the meantime.

The issue has been logged with Google on their bug-tracker at https://code.google.com/p/gmaps-api-issues/issues/detail?id=9925 and has been accepted but at the time of writing has not been fixed.

I will update this answer if/when there is any progress.

Solution 2:

There's a duplicate question here: InfoWindows on Markers in StreetView

This issue occurs when you are trying to use the same marker instance in a Google Map and in the StreetViewPanorama for that map and want to display infoWindows in both.

If you specify the marker in the open method of the infowindow for the StreetViewPanorama object, the infowindow that is supposed to display in StreetView, displays in the map. This is incorrect behavior.

My solution follows:

I've created a codepen that shows this fix: https://codepen.io/moutono/pen/KjZpZB

The problem here seems to be that the map object that is attached to the marker replaces the map object in the infoWindow when you open the infoWindow like this:

streetViewInfowindow.open(panorama, marker); //Won't work because the panorama object is replaced by the map object attached to the marker.

So if you want to display infoWindows on the same marker in both Street View and Map then you have to do it like this:

mapInfowindow.setPosition(position);
mapInfowindow.open(map);
streetViewInfowindow.setPosition(position);
streetViewInfowindow.open(panorama); //This works because panorama objectisnot replaced by mapobjectfrom marker.

Link to Google Issue Tracker

Post a Comment for "Google Maps Streetview Infowindows Opening On Map"