本文介绍了任何方式让gmaps4rails在街景视图中打开地图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着改变缩放级别,但它始终保持在地图模式下。在维基上找不到任何信息。任何帮助或其他建议,将不胜感激。

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.

推荐答案

结束时只使用Google的Javascript API。它是这样的:

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 } );
    }
} );

这篇关于任何方式让gmaps4rails在街景视图中打开地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 17:05