Any way to have gmaps4rails open the map in Street

2019-05-13 00:32发布

I've tried changing the zoom level, but it always stays in the map mode. Couldn't find any info on the wiki either. Any help or other suggestions would be appreciated.

1条回答
小情绪 Triste *
2楼-- · 2019-05-13 01:10

Ended up just using Google's Javascript API. It went something like this:

pos = new google.maps.LatLng( <%= latitude %>, <%= longitude %> );

var div = document.getElementById('streetViewContainer');
var sv = new google.maps.StreetViewPanorama(div);
sv.setPosition( pos );
sv.setVisible( true );

// find the heading by looking from the google car pos to the venue pos
var service = new google.maps.StreetViewService();
service.getPanoramaByLocation( pos, 50, function(result, status) {
    if (status == google.maps.StreetViewStatus.OK) 
    {   
        carPos = result.location.latLng;
        heading = google.maps.geometry.spherical.computeHeading( carPos, pos );
        sv.setPov( { heading: heading, pitch: 0, zoom: 1 } );
    }
} );
查看更多
登录 后发表回答