I am using the Google Map Javascript API and am wondering how I can add a marker to the map while inside of the street view.
When I am overviewing a road, I want to be able to go into Street View, then click on a spot and add a marker to where I click. So far I am not able to find any documentation or help on this matter. Any help would be much appreciated. Thanks!
The click event which is present on the map, does not fire inside the street view. Is there another function? The draggable markers are draggable in street view. So how do I trigger a click to add a marker?
It is not currently possible to add a marker while inside a Street View through click events
Here's the list of events that are available for
StreetViewPanorama:pano_changedposition_changedpov_changedlinks_changedvisible_changedAs you can see, there's no mention of
clickevent. So it would obviously not be available. And theclickis only available in theMapclass and not in theStreetViewPanoramaclass. They are two different classes, so you should set your expectation that they have different functionalities and eventListeners.The
StreetViewPanoramaclass also have this built in click function where it makes you move to the next position of the streetview path.There could also be a lot of factors as to why this is not available in the Street View, like how would the StreetView know which coordinate in the Map was clicked inside the Street View Image?
But you can still file a Feature Request if you want and make sure to add your use case. https://developers.google.com/maps/support#issue_tracker
The reason also why you can still click and drag marker around inside a
StreetViewis because theMarkerclass is also a different class with Map and StreetViewPanorama. If you add an event Listener or make the marker draggable, it would ofcourse still have those functionality regardless if it is inside the Map or the Street View.I hope this clarifies your concern!