Can Overlay / Marker be displayed in a StreetViewPanorama instance?

I'm going to adjust the panorama for the client a bit, and I noticed a problem that I cannot solve.

Markers do not appear in my StreetViewPanorama.

Using some code derived from official examples, I was able to replicate the problem:

The difference seems to be how StreetViewPanorama turns out ...

In the example that works panorama, it comes directly from the map object:panorama = map.getStreetView()

In the example with an error, it panoramais created through panorama = new google.maps.StreetViewPanoramaand assigned to the map with map.setStreetView(panorama).

Unfortunately, but in my case I can’t use map.getStreetView()due to the fact that there is a variable number of panoramas working in slide show mode.

Is there a way to get markers / labels to display in an instance of StreetViewPanorama?

I assume that the reserve will be to overlay some elements <div>and calculate their position and visibility on the screen based on .getPov()and .getPosition(), but this is probably more than I have a budget.

+4
source share
1 answer

I think Documentation means something like this:

 var infoMarker = new google.maps.Marker({
        position: { lat: 42.34550, lng: -71.09830 },
        map: map,
        icon: 'https://chart.apis.google.com/chart?chst=d_map_pin_icon&chld=info|FFFF00',
        title: 'Info'
    });
    cafeMarker.setMap(panorama);
0
source

All Articles