Google Maps Javascript API / Streetview FOV

后端 未结 1 1556
野趣味
野趣味 2021-01-26 07:48

I was wondering if there was any way to change the field of view of a StreetviewPanorama object?

This is not documented anywhere but the Google Maps website does not see

1条回答
  •  北恋
    北恋 (楼主)
    2021-01-26 08:19

    I have a same problem like this. Did you use Firefox too?

    When I'm using Google Maps API on Chrome it's totally the same as the Google Maps. Still can't find a way to solve it.

    The fov should be the same as they mentioned in the documents.

    https://developers.google.com/maps/documentation/javascript/streetview

    So the problem will be the projection they used.

    I just tried to change the user agent to cheating the API that I'm using chrome. And it works.

    navigator.__defineGetter__('userAgent', function(){
        return 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36' // customized user agent
    });
    

    But it turns out very slow when I try to drag the panorama.

    Maybe that's why they're using a big flat image instead of a 3D spherical one.


    2014/08/08 update

    Good news to solve this problem.

    I found a solution here in Google Groups.

    There's a undocumented attribute "mode" can be set in PanoramaOptions.

    You can use 'html4', 'html5' and 'webgl'.

    It will be no fish-eye effect if I set the mode to 'html5'.(But tourdash use 'webgl' instead)

    The following shows the code snippet:

    var panoramaOptions = {
            pano : panoId,
            pov: {
              heading: heading,
              pitch: pitch
            },
            enableCloseButton:false,
            addressControl:false,
            panControl:false,
            visible: true,
            clickToGo:false,
            addressControl:false,
            mode : "html5",
            zoomControlOptions:{
                position : google.maps.ControlPosition.TOP_LEFT
            }
        };
    

    It works way much better than just set the user agent.

    0 讨论(0)
提交回复
热议问题