Google街景视图标题问题 [英] Google Street View heading issue

查看:190
本文介绍了Google街景视图标题问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个项目中工作,我需要显示谷歌地图街景视图朝向道路。

I'm working in a project where I need to show google map street view heading towards road.

我设置了标题:0为全景对象。但是对于不同的位置,它显示的标题不同。例如在某些情况下,它显示朝向街道,一些显示朝向家庭的位置。

I've set the heading: 0 for the panorama object. But for different location it shows the heading differently. for example in some cases it shows heading towards street, for some locations it shows heading towards home.

panorama = theMap.getStreetView();
panorama.setPosition(new google.maps.LatLng(<?php echo $lat; ?>, <?php echo $lng; ?>););
panorama.setPov({
    heading: 0,
    zoom:1,
    pitch:0
});

如果有任何办法可以修改所有帖子的街道标题?

If there any way can fix the heading towards street for all post codes?

谢谢

推荐答案

最后我发现一个非常简单的解决方案..

Finally I found a very easy solution..

对于街景来说,有两个链接可以导航,即指向街道。我只是阅读那些标题,并将街景视图POV设置到该方向。这里是完整的代码。

For the street view there's two links to navigate, that point towards street. I just read those heading and set the street view POV towards that direction. Here's full code.

var panoramaOptions = {
    position: langlongObj,
    visible: true
};
var panorama = new  google.maps.StreetViewPanorama(document.getElementById("map_canvas"), panoramaOptions);
map.setStreetView(panorama);

google.maps.event.addListener(panorama, 'links_changed', function() {
    var links =  panorama.getLinks();

    panorama.setPov({                   
        heading: links[0].heading,
        pitch: 0,
        zoom: 1
    });
});

这篇关于Google街景视图标题问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆