Francesco
Francesco

Reputation: 25259

How do I hide an active street view panorama in google maps api v3?

What is the command to exit street view, when using api v3?

Upvotes: 2

Views: 5169

Answers (2)

xcer
xcer

Reputation: 1707

You can get the StreetViewPanorama that is bound to the map, then set its visibility to false:

var panorama = map.getStreetView();
panorama.setVisible(false);

Or to do it in one line:

map.getStreetView().setVisible(false);

Upvotes: 12

rcravens
rcravens

Reputation: 8388

Here is an excerpt from a jQuery plugin that I wrote:


        this.setTypeRoadMap = function () {
            this.map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
        }
        this.setTypeSatellite = function () {
            this.map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
        }
        this.setTypeHybrid = function () {
            this.map.setMapTypeId(google.maps.MapTypeId.HYBRID);
        }
        this.setTypeTerrain = function () {
            this.map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
        }

You call the 'setMapTypeId' function with one of the above enum values. BTW here is the full jQuery plugin: http://blog.bobcravens.com/2010/06/a-google-maps-version-3-jquery-plugin/

Hope this helps.

Bob

Upvotes: -2

Related Questions